I have a drawer for filter my products, my drawer import from another dart file like this.
This is homePage.dart's
Scaffold. Drawer imported like:
return Scaffold(
key: _scaffoldkey,
appBar:AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black),
onPressed: () => Navigator.pop(context)),
backgroundColor: Colors.white,
title: Text('HomePage',
style: TextStyle(color: Colors.black),
textAlign: TextAlign.left),
),
endDrawer:filterDrawer(context),
This is filterDrawer.dart
file..
Container filterDrawer(context) {
TextStyle childStyle = TextStyle(fontSize: 14);
TextStyle childActiveStyle = TextStyle(fontSize: 14, color: primaryColor);
var _supRepo = Provider.of<SupplierRepo>(context, listen: false);
return Container(
color: Colors.white,
width: MediaQuery.of(context).size.width * 0.75,
child: Column(
children: [Expanded(
child: ListView.builder(
itemCount: _supRepo.storeFilterList.length,
itemBuilder: (context, index) {
return _supRepo.storeFilterList[index]['options'].length == 0
? SizedBox(
height: 0.1,
)
: ExpansionTile(
title: Text(_supRepo.storeFilterList[index]['name']),
childrenPadding: EdgeInsets.only(left: 10),
children: List<Widget>.generate(
_supRepo.storeFilterList[index]['options'].length,
(subIndex) {
return ListTile(
onTap:() {
_supRepo.setFilterData(
_supRepo.storeFilterList[index]
['filterQueryName']
.toString(),
_supRepo.storeFilterList[index]['options']
[subIndex]['id']);
},
trailing: Icon(Icons.check_circle_outline),
title: Text(_supRepo.storeFilterList[index]['options'][subIndex]['name'],
style: _supRepo.filterQueryList[_supRepo.storeFilterList[index]['filterQueryName'].toString()] != null
? (_supRepo.filterQueryList[_supRepo
.storeFilterList[index]
['filterQueryName']
.toString()]
.containsKey(_supRepo
.storeFilterList[index]
['options'][subIndex]
['id']
.toString()) ==
true
? childActiveStyle
: childStyle)
: childStyle),
);
}));
},
),
)]
));
}
As you can see I'm trying to change the child text color. I do this in Provider, but I can't see the color change without hot reloading. When I add notifyListeners();
, Drawer closes.
Gif for you see..