Hello Reader,
Welcome to the 15th post in the "Week In Review" series, where I share the Flutter\Dart tips I tweeted last week.
1- RadioListTile widget is a radio button with a label.
...
RadioListTile<SingingCharacter>(
title: const Text('Thomas Jefferson'),
value: SingingCharacter.jefferson,
groupValue: _character,
onChanged: (SingingCharacter value) { setState(() { _character = value; }); },
),
...
Try it on DartPad here
2- RangeSlider widget is used to select a range from a range of values.
...
RangeSlider(
values: _currentRangeValues,
min: 0,
max: 100,
divisions: 5,
labels: RangeLabels(
_currentRangeValues.start.round().toString(),
_currentRangeValues.end.round().toString(),
),
onChanged: (RangeValues values) {
setState(() {
_currentRangeValues = values;
});
},
);
...
Try it on DartPad here
3- RefreshIndicator is a widget that supports Material's swipe-to-refresh.
...
RefreshIndicator(
onRefresh: () async {
return await Future.delayed(Duration(seconds: 3));
},
child: ListView(
padding: const EdgeInsets.all(8.0),
children: <Widget>[
Container(
height: 50,
color: Colors.amber[600],
child: const Center(child: Text('Entry A')),
),
Container(
height: 50,
color: Colors.amber[500],
child: const Center(child: Text('Entry B')),
),
Container(
height: 50,
color: Colors.amber[100],
child: const Center(child: Text('Entry C')),
),
],
),
),
...
Try it on DartPad here
4- Switch widget is used to toggle the on/off state of a single setting.
...
Switch(
value: isSwitched,
onChanged: (value) {
setState(() {
isSwitched = value;
print(isSwitched);
});
},
activeTrackColor: Colors.lightGreenAccent,
activeColor: Colors.green,
),
...
Try it on DartPad here
5- Tooltip widget helps explaining the function of a button or other user interface action.
...
Tooltip(
message: 'I am a Tooltip',
child: Text('Hover over the text to show a tooltip.'),
);
...
Try it on DartPad here
6- SelectableText Widget allows the user to Select/Copy the content on the UI.
...
const SelectableText(
'Hello! How are you?',
textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.bold),
)
...
Try it on DartPad here
See you next week. 👋🏻
Follow me on Twitter for more tips about #coding, #learning, #technology...etc.
Check my Apps on Google Play & Apple Store
Cover image UX Indonesia on Unsplash
Top comments (0)