• 1000 не работает,
Мой код следующий:
List<bool> isSelected = [false, false, false];
FocusNode focusNodeButton1 = FocusNode();
FocusNode focusNodeButton2 = FocusNode();
FocusNode focusNodeButton3 = FocusNode();
List<FocusNode> focusToggle;
@override
void initState() {
// ignore: todo
// TODO: implement initState
super.initState();
focusToggle = [focusNodeButton1, focusNodeButton2, focusNodeButton3];
}
@override
void dispose() {
// Clean up the focus node when the Form is disposed.
focusNodeButton1.dispose();
focusNodeButton2.dispose();
focusNodeButton3.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: kDefaultPadding / 2),
child: ToggleButtons(
borderColor: Colors.black,
fillColor: Colors.white,
borderWidth: 2,
borderRadius: BorderRadius.circular(2),
selectedBorderColor: kMaincolor,
selectedColor: kMaincolor,
focusNodes: focusToggle,
children: <Widget>[
Padding(
padding: EdgeInsets.all(5),
child: Text(
"Lingkar Teman",
style: TextStyle(fontSize: 15),
),
),
Padding(
padding: EdgeInsets.all(5),
child: Text(
"Orang Lain",
style: TextStyle(fontSize: 15),
),
),
Padding(
padding: EdgeInsets.all(5),
child: Text(
"Semua",
style: TextStyle(fontSize: 15),
),
),
],
isSelected: isSelected,
onPressed: (int index) {
setState(() {
isSelected[index] = !isSelected[index];
});
},
),
),
],
),