0

我不知道为什么在颤振释放模式下会出现灰屏错误但我想正确解决它知道有人给我完美的答案因为我想以任何方式解决它请告诉我

在下面的代码中,在发布模式下出现灰屏.......................... ..................................................... ..................................................... .....................

  drawer.dart

    class MyDrawer extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return Drawer(
          child: ListView(
            children: [
              Container(
                padding:EdgeInsets.only(top: 25.0,bottom:10.0),
                decoration: new BoxDecoration(
                 gradient: new LinearGradient(
                  colors: [Colors.indigo,
                     Colors.lightGreenAccent],
                   begin: const FractionalOffset(0.0, 0.0),
                   end: const FractionalOffset(1.0,0.0),
                   stops: [0.0,1.0],
                   tileMode: TileMode.clamp,
                 ),
                ),
                child: Column(
                  children: [
                    Material(
                      borderRadius:BorderRadius.all(
                       Radius.circular(80.0)),
                      elevation: 8.0,
                      child: Container(
                        height: 120.0,
                        width: 120.0,
                        child: CircleAvatar(
                          backgroundImage:NetworkImage(
                           EcommerceApp.sharedPreferences.getString(EcommerceApp.userAvatarUrl),
                          ),
                        ),
                      ),
                    ),
                    SizedBox(
                      height: 10.0,),
    
                    Text(
                      EcommerceApp.sharedPreferences.getString(EcommerceApp.userName),
                      style: TextStyle(color: Colors.white,fontSize: 35.0,fontFamily: "Signatra"
                    ),
                    ),
                  ],
                ),
              ),
             SizedBox(height:12.0,),
            Container(padding:EdgeInsets.only(top:1.0),
        decoration:new BoxDecoration(
        gradient:new LinearGradient(
        colors:[Colors.blue,Colors.lightGreenAccent],
        begin:const FractionalOffset(0.0,0.0),
        end:const FractionalOffset(1.0,0.0),
        stops:[0.0,1.0],
        tileMode:TileMode.clamp,
        ),
        ),
              child:Column(
                   children: [
                    ListTile(
                        leading:Icon(Icons.home,color:Colors.white),
                      title: Text("Home",style: TextStyle(color: Colors.white),),
                        onTap:(){
                     Route route =MaterialPageRoute(builder:(c)=>MainPage());
                      Navigator.push(context, route);
                        },
                       ),
                              Divider(height: 10.0,color:Colors.white,thickness: 6.0,),
    
                    ListTile(
                       leading:Icon(Icons.reorder,color:Colors.white),
                      title: Text("My Orders",style: TextStyle(color: Colors.white),),
                        onTap:(){
                    Route route =MaterialPageRoute(builder:(c)=>MyOrders());
                      Navigator.push(context, route);
        },
        ),
                 Divider(height: 10.0,color:Colors.white,thickness: 6.0,),
    
                ListTile(
                  leading:Icon(Icons.shopping_cart_outlined,color:Colors.white),
                  title: Text("My Cart",style: TextStyle(color: Colors.white),),
                  onTap:(){
                   Route route =MaterialPageRoute(builder:(c)=>CartPage());
                  Navigator.push(context, route);
        },
        ),
                Divider(height: 10.0,color:Colors.white,thickness: 6.0,),
    
                 ListTile(
                  leading:Icon(Icons.search,color:Colors.white),
                  title: Text("Search",style: TextStyle(color: Colors.white),),
                  onTap:(){
                    Route route =MaterialPageRoute(builder:(c)=>SearchProduct());
                     Navigator.push(context, route);
        },
        ),
                          Divider(height: 10.0,color:Colors.white,thickness: 6.0,),
    
                        ListTile(
                           leading:Icon(Icons.add_location,color:Colors.white),
                           title: Text("Add New address",style: TextStyle(color: Colors.white),),
                          onTap:(){
                          Route route =MaterialPageRoute(builder:(c)=>AddAddress());
                            Navigator.push(context, route);
        },
        ),
                   Divider(height: 10.0,color:Colors.white,thickness: 6.0,),
                     ListTile(
                           leading:Icon(Icons.exit_to_app,color:Colors.white),
                           title: Text("Logout",style: TextStyle(color: Colors.white),),
                          onTap:(){
                          EcommerceApp.auth.signOut().then((c){
                            Route route =MaterialPageRoute(builder: (c)
                            => ChooseScreen());
                            Navigator.pushReplacement(context, route);
                          });
        },
        ),
                   Divider(height: 10.0,color:Colors.white,thickness: 6.0,),
    
    
                     SizedBox(height: 30.0,),
    
                     Text(
                       "Welcome Dear "+EcommerceApp.sharedPreferences.getString(EcommerceApp.userName), style: TextStyle
                       (color: Colors.white, fontSize: 15.0,fontWeight:FontWeight.bold),),
                     Text(
                       "World largest & Number One Online Shop  ", style: TextStyle
                       (color: Colors.white, fontSize: 15.0,fontWeight:FontWeight.w100),),
                     Text(
                       "E-Store-Shopping", style: TextStyle
                       (color: Colors.black,fontFamily: "Signatra",fontSize: 25.0),),
                     Text(
                       "Made in india", style: TextStyle
                       (color: Colors.black,),),
                     Text(
                       "Copyright @ 2021", style: TextStyle
                       (color: Colors.black,),),
                     SizedBox(height: 30.0,),
        ],
        ),
        ),
            ],
          ),
        );
      }
    }
4

1 回答 1

0

如果您在发布模式下出现灰屏,则可能您的屏幕代码有问题。尝试调试模式并检查您的代码。

于 2021-04-12T08:52:27.270 回答