Hello all,
Welcome to the Colombo flutter community gitter channel. we would love to see that you folks are sharing content only related to flutter, dart or relevant in this gitter channel.
Also, we highly recommend you to request for a gitter room for any of the projects which is published through the Colombo Flutter Community GitHub.
let's flirt with flutter ...
I have little issue in one of my sample app.
If anyone can help me to sort this out , that would be a great help.
i have created sample application and i use streams to load data to screen , i have one screen to save data , and same screen is used to edit the saved data.At bottom navigation bar i have 3 options to select , lets call them "Option A","Option B" and "Option C" , user tap on "Option B" and save the data. i store them in database.once user loads edit screen i have to load all option and previously saved option. i load master data (all options) using bloc and bind data to bottom navigation bar , How do i set the previously selected option when form load ?
Widget _buildBottomNavigationBar() {
List<BottomNavigationBarItem> items = List();
int iconIdex = 1;
return StreamBuilder(
stream: _ratioBloC.inputObservable(),
builder:
(context, AsyncSnapshot<List<CementSandAggregateView>> snapshot) {
_scaffoldContext = context;
if (snapshot.hasData) {
snapshot.data.forEach((mix) => {
items.add(BottomNavigationBarItem(
icon: iconIdex == 1
? Icon(Icons.filter_1)
: iconIdex == 2
? Icon(Icons.filter_2)
: Icon(Icons.filter_3),
title: Column(
children: <Widget>[Text(mix.name), Text(mix.ratio)],
))),
ratioArr[iconIdex - 1] = mix.id,
iconIdex++
});
return BottomNavigationBar(
items: items,
currentIndex: _selectedRatio,
fixedColor: Theme.of(context).buttonColor,
onTap: _onItemTapped);
} else {
return Container(
height: 0.0,
width: 0.0,
);
}
},
);
}
class CementSandAggregateMixBloC {
BehaviorSubject<List<CementSandAggregateView>> _cSAMixController;
BLoCProvider provider;
CementSandAggregateMixBloC(){
provider = new BLoCProvider();
_cSAMixController = new BehaviorSubject<List<CementSandAggregateView>>();
_init();
}
_init() async{
List<CementSandAggregateView> data = await provider.getAllRatios();
_cSAMixController.add(data);
}
Observable<List<CementSandAggregateView>> inputObservable() => _cSAMixController.stream;
void dispose() {
_cSAMixController.close();
}
}