Flutter:- show BottomSheet transparency

后端 未结 5 1778
傲寒
傲寒 2021-02-14 12:10

I want to open a showBottomSheet. here is my code which working fine, I am able to open ButtomSheet, but it\'s not giving transparency effect. that I could see behind of this sh

5条回答
  •  遥遥无期
    2021-02-14 12:36

    BottomSheet use default background color of MaterialType.canvas, so in order to set it to transparent for the whole app you may init MaterialApp like that:

    new MaterialApp(
      title: 'Transparent Bottom Bar',
      theme: new ThemeData(
        canvasColor: Colors.transparent
      ),
      home: new YourAppPage()
    

    As an alternative you set it just for one Widget by using Theme widget like that:

    @override
    Widget build(BuildContext context) {
      return
        Theme(
          data: Theme.of(context).copyWith(canvasColor: Colors.transparent),
          child: ...);
    

提交回复
热议问题