1+ import 'package:flutter/cupertino.dart' ;
12import 'package:flutter/material.dart' ;
23import 'package:gridproxy_client/models/farms.dart' ;
34import 'package:tfchain_client/models/dao.dart' ;
@@ -22,7 +23,8 @@ class _VoteDialogState extends State<VoteDialog> {
2223 List <Farm > farms = [];
2324
2425 void setFarms () async {
25- List <Farm > farmsList = await getMyFarms (8711 ); //TODO: replace with actual twin id
26+ List <Farm > farmsList =
27+ await getMyFarms (0 ); //TODO: replace with actual twin id
2628 setState (() {
2729 farms = farmsList;
2830 });
@@ -60,50 +62,65 @@ class _VoteDialogState extends State<VoteDialog> {
6062 direction: Axis .vertical,
6163 mainAxisSize: MainAxisSize .min,
6264 children: [
63- Flexible (
64- fit: FlexFit .loose,
65- child: DropdownMenu (
66- menuHeight: MediaQuery .sizeOf (context).width * 0.5 ,
67- enableFilter: true ,
68- width: MediaQuery .sizeOf (context).width * 0.6 ,
69- textStyle: TextStyle (color: white, fontFamily: interBold),
70- inputDecorationTheme: const InputDecorationTheme (
71- filled: true ,
72- fillColor: backgroundColor,
73- border: OutlineInputBorder (
74- borderRadius: BorderRadius .all (Radius .circular (15 )),
75- borderSide: BorderSide .none,
65+ DropdownMenu (
66+ menuHeight: MediaQuery .sizeOf (context).height * 0.3 ,
67+ enableFilter: true ,
68+ width: MediaQuery .sizeOf (context).width * 0.55 ,
69+ textStyle:
70+ TextStyle (color: white, fontFamily: interBold, fontSize: 14 ),
71+ trailingIcon: const Icon (
72+ CupertinoIcons .chevron_down,
73+ color: white,
74+ size: 18 ,
75+ ),
76+ selectedTrailingIcon: const Icon (
77+ CupertinoIcons .chevron_up,
78+ color: white,
79+ size: 18 ,
80+ ),
81+ inputDecorationTheme: const InputDecorationTheme (
82+ filled: true ,
83+ fillColor: backgroundColor,
84+ enabledBorder: UnderlineInputBorder (
85+ borderRadius: BorderRadius .all (Radius .circular (4 )),
86+ borderSide: BorderSide (
87+ color: secondaryColor,
88+ width: 8.0 ,
7689 ),
7790 ),
78- menuStyle: MenuStyle (
79- backgroundColor:
80- MaterialStateProperty .all <Color >(backgroundColor),
81- surfaceTintColor:
82- MaterialStateProperty .all <Color >(Colors .transparent),
83- shape: MaterialStateProperty .all <RoundedRectangleBorder >(
84- const RoundedRectangleBorder (
85- borderRadius: BorderRadius .all (Radius .circular (10 )),
86- ),
91+ contentPadding: EdgeInsets .only (right: 5 , left: 15 ),
92+ ),
93+ menuStyle: MenuStyle (
94+ backgroundColor:
95+ MaterialStateProperty .all <Color >(backgroundColor),
96+ surfaceTintColor:
97+ MaterialStateProperty .all <Color >(Colors .transparent),
98+ shape: MaterialStateProperty .all <RoundedRectangleBorder >(
99+ const RoundedRectangleBorder (
100+ borderRadius: BorderRadius .all (Radius .circular (4 )),
87101 ),
88102 ),
89- label: Text (
90- 'Select Farm' ,
91- style: TextStyle (color: white, fontFamily: interBold),
92- ),
93- dropdownMenuEntries: _buildDropdownMenuEntries (farms),
94- onSelected: (int ? value) {
95- if (value != null ) {
96- farmId = value;
97- }
98- },
103+ padding: MaterialStateProperty .all <EdgeInsets >(
104+ const EdgeInsets .only (right: 5 , left: 15 , bottom: 5 )),
105+ ),
106+ label: Text (
107+ 'Select Farm' ,
108+ style: TextStyle (
109+ color: white, fontFamily: interBold, fontSize: 14 ),
99110 ),
111+ dropdownMenuEntries: _buildDropdownMenuEntries (farms),
112+ onSelected: (int ? value) {
113+ if (value != null ) {
114+ farmId = value;
115+ }
116+ },
100117 ),
101118 const SizedBox (height: 20 ),
102119 Row (
103120 mainAxisAlignment: MainAxisAlignment .spaceEvenly,
104121 children: [
105122 TextButton (
106- onPressed: () async {
123+ onPressed: () {
107124 if (farmId != null ) {
108125 vote (true , widget.proposal.hash, farmId! );
109126 }
@@ -124,7 +141,7 @@ class _VoteDialogState extends State<VoteDialog> {
124141 ),
125142 ),
126143 TextButton (
127- onPressed: () async {
144+ onPressed: () {
128145 if (farmId != null ) {
129146 vote (false , widget.proposal.hash, farmId! );
130147 }
0 commit comments