add length picker
This commit is contained in:
41
lib/pages/widgets/local_radio_buttons.dart
Normal file
41
lib/pages/widgets/local_radio_buttons.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LocalRadioButtons<T> extends StatelessWidget {
|
||||
final Function(T) callback;
|
||||
final IconData iconData;
|
||||
final T selectedValue;
|
||||
final List<T> values;
|
||||
|
||||
const LocalRadioButtons(
|
||||
{Key key, this.callback, this.iconData, this.selectedValue, this.values})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(children: getChildren());
|
||||
}
|
||||
|
||||
List<Widget> getChildren() {
|
||||
return values
|
||||
.toList()
|
||||
.map((e) => SizedBox(
|
||||
height: 30,
|
||||
child: InkWell(
|
||||
onTap: () => callback(e),
|
||||
child: Row(children: <Widget>[
|
||||
Radio<T>(
|
||||
activeColor: primaryColor,
|
||||
groupValue: selectedValue,
|
||||
value: e,
|
||||
onChanged: (T value) {
|
||||
callback(value);
|
||||
},
|
||||
),
|
||||
Text(e.toString()),
|
||||
]),
|
||||
)))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user