A radio component suitable for almost any radio scenario.

Related tags

Templates fradio
Overview

fradio

A radio component suitable for almost any radio scenario.

Supports excellent interactive special effects, as well as a simple multi-interactive state view switching construction like eating a hamburger 🍔 . You will fall in love with TA .️

Author:Newton([email protected])

English | 简体中文

Like it? Please cast your Star 🥰

Features

  • Wonderful interactive animation

  • Support precise control of rounded corners

  • Wonderful gradient effect support

  • Simple but effective multi-state view building support

  • Unimaginable flexible configurable items

🛠 Guide

⚙️ Parameters

🔩 Basic parameters

Param Type Necessary Default desc
value <T> false null The value represented by [FRadio]. When [groupValue] == [value], enter the selected state.
groupValue <T> false null The currently selected value of the radio group. When [groupValue] == [value], enter the selected state.
onChanged ValueChanged<T> false null Callback when [FRadio] is selected
enable bool false true it's usable or not. Unavailable [FRadio] will not be able to change the current state by clicking. Through [disableNormal] and [disableSelected], you can customize the style in the unavailable state.
toggleable bool false false Is it possible to uncheck it.
width double false 27 width
height double false 27 height
normal Widget false null Unselected state style
selected Widget false null Selected state style
disableNormal Widget false null Unavailable style when unchecked
disableSelected Widget false null Unavailable styles selected
hover Widget false null The style when the mouse enters
focusNode FocusNode false null focus
autofocus bool false false Whether to allow automatic focus

🔩 Default constructor extension parameters

Param Type Necessary Default desc
normalColor Color false Color(0xffd9d9d9) Unselected color
selectedColor Color false Color(0xff2593fc) Selected color
hasSpace bool false true Is there a gap between the inner padding and the edges? The default is true. The spacing is provided by [FRadio] the golden ratio, developers do not need to care.
border double false null The border is wide. By default, [FRadio] provides the golden ratio, and developers do not need to care.
child Widget false null The decoration components in the unselected state are at the top level.
selectedChild Widget false null The decorative component in the selected state is at the top level.
hoverChild Widget false null The decoration component when hovering the mouse is at the top level.
gradient Gradient false null This property allows to configure the gradient effect in the selected state, which will override [selectedColor].
duration Duration false Duration(milliseconds: 150) Duration of state switching animation.
fill bool false true When selected, whether to allow internal filling.
corner FRadioCorner false Circle Corner.

📺 Demo

🔩 Basic Demo

FRadio(
  value: 1,
  groupValue: groupValue_1,
  onChanged: (value) {
    setState(() {
      groupValue_1 = value;
    });
  },
),

FRadio(
  value: 2,
  groupValue: groupValue_1,
  onChanged: (value) {
    setState(() {
      groupValue_1 = value;
    });
  },
)

A regular FRadio is very simple to build. You only need to configure:

value: It will indicate the current value represented by FRadio.

groupValue:Indicates the selected value of the current radio group.

onChanged:When selected, it will callback. In this callback, you need to assign the value value of FRadio to the radio group groupValue to complete the switch of group options.

💡 It is worth noting that FRadio will only be selected when groupValue == value. This is very flexible, that is to say, you only need to change the groupValue to switch options at will.

👀 Enable & Toggleable

FRadio(
  value: 1,
  groupValue: groupValue_2,
  onChanged: (value) {
    setState(() {
      groupValue_2 = value;
    });
  },
  toggleable: true,
  enable: enable_1,
  selectedColor: Color(0xffffc900),
),

Through the enable attribute, you can control the availability of FRadio. When FRadio is not available, the unavailable style will be displayed. They of course include selected and unselected.

The unavailable styles of FRadio built by the default constructor are grayed out.

If you want to build different unavailable styles, you can configure disableNormal (unchecked unavailable styles) and disableSelected (check unavailable styles) through the FRadio.custom () constructor.

FRadio will allow the user to cancel the selection, which can be achieved by configuring toggleable: true. Of course, by default, we do not open this feature.

🔆 Space & Corner & Border

FRadio(
  width: 100,
  height: 50,
  value: 1,
  groupValue: groupValue_3,
  onChanged: (value) {
    setState(() {
      groupValue_3 = value;
    });
  },
  selectedColor: Color(0xffffc900),
  corner: FRadioCorner(leftTopCorner: 6, leftBottomCorner: 6),
  border: 1,
  hasSpace: false,
  selectedChild:
      Text("FSuper", style: TextStyle(color: Color(0xff333333))),
  child: Text("FSuper", style: TextStyle(color: Color(0xff333333))),
)

In this chestnut 🌰 , FRadio shows several abilities that are not possible for radio components.

Through the corner attribute, you can accurately control the corners so that FRadio is no longer a circle.

hasSpace gives you the freedom to choose whether you want to keep the distance between the inner padding and the edges, as it is by default.

Usually, FRadio has a set of exquisite calculation methods internally to provide a very beautiful view. By default, FRadio will automatically calculate the width of the border to maintain a harmonious aesthetic.

But you can still configure it as needed through the border attribute.

🌈 Gradient

FRadio(
  width: 50,
  height: 50,
  value: index + 1,
  groupValue: groupValue_4,
  onChanged: (value) {
    setState(() {
      groupValue_4 = value;
    });
  },
  gradient: LinearGradient(
    colors: [
      Color(0xffFEFDBB),
      Color(0xffFFE16C),
      Color(0xffEA9D1C),
      Color(0xffD46307),
    ],
    begin: Alignment(-0.1, -0.9),
    end: Alignment(1.0, 1.0),
    stops: [0.0, 0.2, 0.7, 1.0],
  ),
  selectedColor: Color(0xffffc900),
  hasSpace: false,
  border: 1.5,
  child: Text(
    "\$${5 * (index + 1)}",
    style: TextStyle(color: Color(0xffd9d9d9), fontSize: 13),
  ),
  hoverChild: Text(
    "\$${5 * (index + 1)}",
    style:
        TextStyle(color: Colors.deepOrangeAccent, fontSize: 13),
  ),
  selectedChild: Text("\$${5 * (index + 1)}",
      style: TextStyle(
          color: Colors.deepOrangeAccent, fontSize: 13)),
)

You see, this is the magical use of gradients.

gradient accepts multiple types of gradient configurations. If you plan to make the radio view look more colorful or more spatial, you can try it.

🍭 Decoration

FRadio(
  width: 80,
  height: 80,
  value: 1,
  groupValue: groupValue_5,
  onChanged: (value) {
    setState(() {
      groupValue_5 = value;
    });
  },
  child: Image.asset("assets/emoji_0.png", width: 50),
  hoverChild: Image.asset("assets/emoji_1.png", width: 50),
  selectedChild: Image.asset("assets/emoji_2.png", width: 50),
  hasSpace: false,
  toggleable: true,
  selectedColor: Color(0xffffc900),
  border: 1.5,
)

FRadio magically makes the entire radio no longer boring!

child and selectedChild configure the top-level decorative components.

How is the mouse hover effect constructed?

The border color will automatically accept the selected color configured by selectedColor when hovering. The decoration can be configured through hoverChild.

When hoverChild is not configured, the selected state decoration configured by selectedChild will be accepted.

how about it? This is so interesting!

🎨 This is customizable!

If the default constructor does not satisfy you, what else do you need?

By the way, Customize!

Through the FRadio.custom () constructor, you can configure the style of FRadio in different interactive states through: normal, selected, disableNormal, disableSelected, hover.

This will untie the hemp rope in your hand, you are free, and you can start to create at will.

ListView.builder(
  itemCount: list.length,
  itemBuilder: (context, index) {
    return FRadio.custom(
      value: index,
      groupValue: groupValue_7,
      onChanged: (value) {
        setState(() {
          groupValue_7 = value;
        });
      },
      normal: Container(
        width: 250,
        height: 100,
        color: Colors.white,
        padding: EdgeInsets.only(left: 12, right: 12),
        child: text(index),
      ),
      hover: Container(
        width: 250,
        height: 100,
        color: Color(0xff212121).withOpacity(0.05),
        padding: EdgeInsets.only(left: 12, right: 12),
        child: text(index),
      ),
      selected: Container(
        padding: EdgeInsets.only(left: 12, right: 12),
        color: Color(0xff607D8B).withOpacity(0.2),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.center,
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text("${list[index]}"),
            Icon(
              Icons.check,
              size: 18,
            ),
          ],
        ),
      ),
    );
  },
)

Now you are free, so don't skimp on creativity.

FRadio is not just a small round button, it can solve almost all radio problems.

😃 How to use?

Add dependencies in the project pubspec.yaml file:

🌐 pub dependency

dependencies:
  fradio: ^<version number>

⚠️ Attention,please go to [pub] (https://pub.dev/packages/fradio) to get the latest version number of FRadio

🖥 git dependencies

dependencies:
  fradio:
    git:
      url: '[email protected]:Fliggy-Mobile/fradio.git'
      ref: ''<Branch number or tag number>'

⚠️ Attention,please refer to [FRadio] (https://github.com/Fliggy-Mobile/fradio) official project for branch number or tag.

💡 License

Copyright 2020-present Fliggy Android Team <[email protected]>.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at following link.

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Like it? Please cast your Star 🥰

--

How to run Demo project?

  1. clone project to local

  2. Enter the project example directory and run the following command

flutter create .
  1. Run the demo in example
You might also like...

From then on, developers only need to master one Button component, which is enough.

From then on, developers only need to master one Button component, which is enough.

FButton From then on, developers only need to master one Button component, which is enough. Support corners, borders, icons, special effects, loading

Nov 22, 2022

An interesting and practical switch component.

An interesting and practical switch component.

FSwitch An interesting and practical switch component. Supports setting tips, slider decorations, shadows, and good interaction. Author:Newton(coorchi

Dec 13, 2022

The component created with Flutter using Dart programming language, inspired in Fluid Slider by Ramotion.

The component created with Flutter using Dart programming language, inspired in Fluid Slider by Ramotion.

Fluid Slider Flutter The component created with Flutter using Dart programming language, inspired in Fluid Slider by Ramotion. About The component was

Sep 30, 2022

Flutter component Gradient Progress Indicator

Gradient Progress Indicator Introduction This package shows a circular progress indicator with gradient colors, and it is possible insert texts inside

Dec 5, 2022

A list component that refreshes and adds more data for Flutter.

Language: English | 中文简体 Dynamic List View A list component that can refreshes and adds more data for Flutter App. 🚀 github Installation Add this to

Sep 27, 2022

Flutter component concept created with Flutter using Dart programming language, inspired by Gooey Rab Bar.

Flutter component concept created with Flutter using Dart programming language, inspired by Gooey Rab Bar.

Gooey Tab Bar Flutter Flutter component concept created with Flutter using Dart programming language, inspired by Gooey Tab Bar. About This component

Dec 14, 2022

UI component for Niddler.

UI component for Niddler.

Niddler-ui Niddler is a network debugging utility for Android apps that caches network requests/responses, and exposes them over a websocket. It comes

Jan 8, 2022

Magpie-fly is a component library produced by 58 Group, which encapsulates a variety of common components to meet the needs of developers

[toc] magpie_fly Magpie-fly 是58集体出品组件库,封装了多种常用组件,以满足开发者需求。(Magpie-fly is a component library produced by 58 Group, which encapsulates a variety of com

Mar 18, 2022

Call Kit is a prebuilt feature-rich call component, which enables you to build one-on-one and group voice/video calls into your app with only a few lines of code.

Call Kit is a prebuilt feature-rich call component, which enables you to build one-on-one and group voice/video calls into your app with only a few lines of code.

Call Kit (ZegoUIKitPrebuiltCall) Call Kit is a prebuilt feature-rich call component, which enables you to build one-on-one and group voice/video calls

Dec 26, 2022
Owner
Fliggy Mobile
We create legends
Fliggy Mobile
With TOT you can find a teacher that is suitable for your needs with less effort, less time, and less money.

TOT App In TOT we are here to help you find a teacher at any aspect of science you want from kindergarten to secondary schools. Instead of searching m

Ahmed Hussein 2 Sep 29, 2022
Flutter pos - A mobile POS written in Flutter, suitable for small cafe/restaurant, fully offline

Simple-POS A mobile POS written in Flutter, suitable for small cafe/restaurant,

Muhammed Basil E 7 Nov 2, 2022
Flutter custom carousel slider - A carousel slider widget,support custom decoration suitable for news and blog

flutter_custom_carousel_slider A carousel slider Flutter widget, supports custom

Emre 40 Dec 29, 2022
A simple detailed flutter widget that looks almost the same as the real instagram mention widget.

Instagram Mention Widgets 'small details do matter' ❤️ This package provides simple and almost the same UI details that the real Instagram mention wid

AbdulMuaz Aqeel 20 Oct 10, 2022
An isolated worker for Flutter (Isolate) and Web (Web Worker). Behaves almost the same as the compute function, except it is not a one-off worker.

A singleton isolated worker for all platforms. On most platforms, it uses Flutter's Isolate, except on the web, since Isolate is not available, it use

Iandi Santulus 30 Nov 11, 2022
Mobile app for small food business have more results spending almost nothing.

ilunch Mobile app for small food business have more results spending almost nothing. Getting Started This project is a starting point for a Flutter ap

Roque Costa 9 Nov 17, 2022
Serialize almost everything you ever need! 📦 Supports serializing MaterialColor, Color, Size, Locale, IconData, UuidValue, DateTime, Directory, File, Duration, and many more.

osum_serializable The goal is to serialize almost everything you ever need! json_serializable is an amazing package to serialize classes but cannot se

Aswin Murali 2 Sep 23, 2022
A music player component for Flutter (i.e. Spotify, Apple Music, etc.) [AGPL/example/no longer maintaining]

This is an example I currently have no plans of putting this on Pub. Originally, I did, but I lost interest. However, I think this is a good example,

Tobe Osakwe 215 Dec 12, 2022
Simple and fast Entity-Component-System (ECS) library written in Dart.

Fast ECS Simple and fast Entity-Component-System (ECS) library written in Dart. CPU Flame Chart Demonstration of performance for rotation of 1024 enti

Stanislav 8 Nov 16, 2022