Closed dvlj closed 5 years ago
Could you pleasse share your full solid bottom sheet widget? Thank you :)
Widget build(BuildContext context) {
return Scaffold(
body: _getImageLayer(),
bottomSheet: SolidBottomSheet(
controller: _controller,
minHeight: MediaQuery.of(context).size.height * 0.7,
maxHeight: MediaQuery.of(context).size.height * 0.9,
body: _getMenuLayer(),
),
);
}
Widget _getMenuLayer() {
return Container(
padding: EdgeInsets.only(top: 20),
decoration: BoxDecoration(
color: Colors.cyan[900],
borderRadius: BorderRadius.only(
topLeft: Radius.circular(25.0),
topRight: Radius.circular(25.0),
),
),
child: NotificationListener<ScrollNotification>(
onNotification: (scrollNotification) {
if (scrollNotification is ScrollStartNotification) {
} else if (scrollNotification is ScrollUpdateNotification) {
if (scrollNotification.metrics.pixels > _currentPosition) {
_controller.show();
setState(() {
_firstStateEnabled = false;
});
}
} else if (scrollNotification is ScrollEndNotification) {
if (scrollNotification.metrics.pixels == 0) {
_controller.hide();
setState(() {
_firstStateEnabled = true;
});
}
}
_currentPosition = scrollNotification.metrics.pixels;
return true;
},
child: CustomScrollView(
physics: ClampingScrollPhysics(),
slivers: [
_itemHeader(),
_itemAmount(),
_items(0),
_items(1),
_items(2),
_items(3),
_itemRemark(),
_itemBottom(),
],
),
),
);
}
Also, I get this error when i setState inside SolidBottomSheet widget: This SolidBottomSheet widget cannot be marked as needing to build because the framework is already in the process of building widgets.
I got this work by setting Theme color:
theme: new ThemeData(
primarySwatch: Colors.blue,
canvasColor: Colors.transparent,
),