Advertisement
OmarYehiaDev

Untitled

Sep 13th, 2020 (edited)
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.07 KB | None | 0 0
  1. Container(
  2.                   child: ListTile(
  3.                     title: Text("Category :-"),
  4.                     subtitle: DropdownButtonFormField<Service>(
  5.                       value: _category,
  6.                       items: List.generate(
  7.                         snapshot.data.length,
  8.                         (index) => DropdownMenuItem<Service>(
  9.                           child: Text(snapshot.data[index].name),
  10.                           value: snapshot.data[index],
  11.                         ),
  12.                       ),
  13.                       hint: Text("Choose.."),
  14.                       onChanged: (value) {
  15.                         setState(() {
  16.                           _category = value;
  17.                         });
  18.                       },
  19.                     ),
  20.                   ),
  21.                 ),
  22.                 //TODO:- need to work on it
  23.  
  24.                 Container(
  25.                   child: ListTile(
  26.                     title: Text("Service :-"),
  27.                     subtitle: (_category != null)
  28.                         ? DropdownButtonFormField<SubService>(
  29.                             value: _service,
  30.                             items: List.generate(
  31.                               _category.childs.length,
  32.                               (index) => DropdownMenuItem<SubService>(
  33.                                 child: Text(_category.childs[index].name),
  34.                                 value: _category.childs[index],
  35.                               ),
  36.                             ),
  37.                             hint: Text("Choose.."),
  38.                             onChanged: (value) {
  39.                               setState(() {
  40.                                 _service = value;
  41.                               });
  42.                             },
  43.                           )
  44.                         : Text(
  45.                             "Choose a category first!",
  46.                             style: TextStyle(
  47.                               color: Colors.red,
  48.                             ),
  49.                           ),
  50.                   ),
  51.                 ),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement