Flutter apk-release shows black and grey screen

0

Well I developed an app with flutter, and it looks great and stuff.. Yesterday I built the apk file and it worked great (except another problem I had but it's probably fixed). I remember I changed the code a bit but it still works on my emulator perfectly. Now all I see is a black and grey screen like that: Here's what I see in my phone

Source code:

class SchoolplerMainPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        debugShowCheckedModeBanner: false,
        color: Color(0xFF1C1D21),
        theme: ThemeData(
            fontFamily: "Nunito",
            scaffoldBackgroundColor: Color(0xFF1C1D21),
            textTheme: Theme.of(context)
                .textTheme
                .apply(displayColor: Color(0xFFFFFFFF))),
        home: HomeScreen());
  }
}

class HomeScreen extends StatelessWidget {
  Container myHomework(
      String heading, String subHeading, String hwCategoryEmoji) {
    return Container(
        width: 150,
        child: Card(
          color: Color(0xFF3D3D3D),
          child: Wrap(
            children: <Widget>[
              Align(
                alignment: Alignment.topRight,
                child: Container(
                  height: 25,
                  width: 25,
                  decoration: BoxDecoration(shape: BoxShape.circle),
                  child: Image.asset("assets/images/123.png"),
                ),
              ),
              ListTile(
                title: Text(
                  heading,
                  style: TextStyle(
                      fontWeight: FontWeight.w900,
                      fontSize: 13,
                      color: Colors.white),
                ),
                subtitle: Text(
                  subHeading,
                  style: TextStyle(fontWeight: FontWeight.w800, fontSize: 11),
                ),
              )
            ],
          ),
        ));
  }

  final String personName = "ליאם רחום";
  final String personImage =
      "https://instagram.ftlv6-1.fna.fbcdn.net/v/t51.2885-15/e35/p1080x1080/100909907_261706925023177_4991314082934193948_n.jpg?_nc_ht=instagram.ftlv6-1.fna.fbcdn.net&_nc_cat=101&_nc_ohc=qvNVUzKyb04AX-jlrb_&oh=55c9b8538d7c55375e5cf9d976d64c4c&oe=5F15CB42";
  final String currentCourse = "פייתון - מתקדמים";
  final String currentCourseImage =
      "https://images.unsplash.com/photo-1461749280684-dccba630e2f6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80";
  final String popularCourseImage =
      "https://images.wallpapersden.com/image/download/liquicity-digital-art_62312_1920x1080.jpg";
  final String popularCourseTitle = "למדו אומנות דיגיטלית\n עכשיו בשידור חי!";
  final String hw = "מתמטיקה";
  final String hwCategory = "נושא - אלגברה";
  final String hwCategoryPicture =
      "https://c4.wallpaperflare.com/wallpaper/926/800/33/math-wallpaper-preview.jpg";
  final String hwCategoryEmoji = "🔢";
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xFF1C1D21),
      body: Stack(
        children: <Widget>[
          Row(
            children: <Widget>[
              SafeArea(
                  child: Padding(
                padding: const EdgeInsets.symmetric(horizontal: 20),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Align(
                      alignment: Alignment.topLeft,
                      child: Container(
                        alignment: Alignment.center,
                        height: 62,
                        width: 62,
                        decoration: BoxDecoration(shape: BoxShape.circle),
                      ),
                    )
                  ],
                ),
              )),
              Padding(
                padding: EdgeInsets.only(
                  left: 90,
                ),
              ),
              Align(
                  alignment: Alignment(0, -0.85),
                  child: Flexible(
                    child: Text("שלום, $personName!",
                        style: TextStyle(
                            color: Colors.white,
                            fontWeight: FontWeight.w900,
                            fontSize: 16)),
                  ))
            ],
          ),
          SafeArea(
            child: Padding(
              padding: const EdgeInsets.symmetric(horizontal: 20),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Align(
                    alignment: Alignment.topLeft,
                    child: Container(
                      alignment: Alignment.center,
                      height: 62,
                      width: 62,
                      decoration: BoxDecoration(
                        color: Color(0xFF3D3D3D),
                        shape: BoxShape.circle,
                      ),
                      child: Container(
                        width: 62,
                        height: 62,
                        decoration: BoxDecoration(
                          shape: BoxShape.circle,
                          image: DecorationImage(
                            image: NetworkImage(personImage),
                            fit: BoxFit.cover,
                          ),
                          boxShadow: [
                            BoxShadow(
                                color: Colors.black,
                                spreadRadius: -8,
                                blurRadius: 13,
                                offset: Offset(3, 3))
                          ],
                        ),
                      ),
                    ),
                  ),
                  Padding(
                    padding: EdgeInsets.only(top: 30),
                  ),
                  Container(
                      child: Row(
                    children: <Widget>[
                      Padding(
                        padding: EdgeInsets.only(left: 10),
                      ),
                      Container(
                        height: 80,
                        width: 300,
                        decoration: BoxDecoration(
                            borderRadius: BorderRadius.circular(30),
                            gradient: LinearGradient(
                                begin: Alignment.topLeft,
                                end: Alignment.bottomRight,
                                colors: [
                                  Color(0xFFFF2424),
                                  Color(0xFF8630F6)
                                ])),
                        child: Row(
                          children: <Widget>[
                            Padding(
                              padding: EdgeInsets.only(left: 10),
                            ),
                            Align(
                              alignment: Alignment.centerRight,
                              child: Container(
                                  width: 75.0,
                                  height: 55.0,
                                  decoration: new BoxDecoration(
                                      shape: BoxShape.rectangle,
                                      image: new DecorationImage(
                                        fit: BoxFit.fill,
                                        image: NetworkImage(currentCourseImage),
                                      ),
                                      borderRadius: BorderRadius.circular(20))),
                            ),
                            Flexible(
                              child: ListView(
                                children: <Widget>[
                                  Align(
                                      alignment: Alignment(0, -0.7),
                                      child: Row(
                                        children: <Widget>[
                                          Padding(
                                            padding: EdgeInsets.only(left: 100),
                                          ),
                                          Text(
                                            ":קורס נוכחי",
                                            style: TextStyle(
                                                color: Colors.white,
                                                fontWeight: FontWeight.w900,
                                                fontSize: 17,
                                                decoration:
                                                    TextDecoration.underline),
                                          ),
                                          Padding(
                                            padding: EdgeInsets.only(top: 10),
                                          ),
                                        ],
                                      )),
                                  Padding(
                                    padding: EdgeInsets.only(top: 5),
                                  ),
                                  Align(
                                    alignment: Alignment(-3, 0),
                                    child: Flexible(
                                      child: Align(
                                        alignment: Alignment(.44, 0),
                                        child: Text(
                                          currentCourse,
                                          style: TextStyle(
                                            fontWeight: FontWeight.w900,
                                            fontSize: 17,
                                            color: Colors.white,
                                          ),
                                        ),
                                      ),
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ],
                        ),
                      ),
                    ],
                  )),
                  Padding(
                    padding: EdgeInsets.only(top: 18),
                  ),
                  Flexible(
                      child: Align(
                    alignment: Alignment.topRight,
                    child: Text(
                      "פופולארי בקרב תלמידים",
                      style: TextStyle(
                          fontWeight: FontWeight.w900,
                          fontSize: 15,
                          color: Colors.white),
                    ),
                  )),
                  Align(
                    alignment: Alignment.center,
                    child: Container(
                      width: 300.0,
                      height: 85.0,
                      decoration: new BoxDecoration(
                        shape: BoxShape.rectangle,
                        image: new DecorationImage(
                          fit: BoxFit.cover,
                          image: NetworkImage(popularCourseImage),
                        ),
                        borderRadius: BorderRadius.circular(20),
                      ),
                      child: Align(
                        alignment: Alignment(0, -0.5),
                        child: Text(
                          popularCourseTitle,
                          textAlign: TextAlign.center,
                          style: TextStyle(
                              color: Colors.white,
                              fontWeight: FontWeight.w900,
                              fontSize: 15,
                              shadows: [
                                Shadow(
                                  color: Color(0xFF000000),
                                  offset: Offset(-1, 1),
                                  blurRadius: 3,
                                )
                              ]),
                        ),
                      ),
                    ),
                  ),
                  Padding(
                    padding: EdgeInsets.only(top: 15),
                  ),
                  Flexible(
                      child: Align(
                    alignment: Alignment.topRight,
                    child: Text("משימות לעשות",
                        style: TextStyle(
                            color: Colors.white,
                            fontWeight: FontWeight.w900,
                            fontSize: 16)),
                  )),
                  Container(
                      margin: EdgeInsets.symmetric(vertical: 10.0),
                      height: 100,
                      child: ListView(
                        scrollDirection: Axis.horizontal,
                        children: <Widget>[
                          myHomework(hw, hwCategory, hwCategoryEmoji),
                          myHomework(hw, "נושא - גיאומטריה", hwCategoryEmoji),
                          myHomework(hw, hwCategory, hwCategoryEmoji),
                        ],
                      )),
                  Padding(
                    padding: EdgeInsets.only(top: 20),
                  ),
                  Padding(
                    padding: EdgeInsets.only(top: 20),
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                      Align(
                          alignment: Alignment.bottomRight,
                          child: FloatingActionButton.extended(
                              heroTag: "profileBtn",
                              icon: Icon(Icons.person),
                              label: Text(
                                "פרופיל",
                                style: TextStyle(fontWeight: FontWeight.w800),
                              ),
                              onPressed: () {
                                Navigator.push(
                                  context,
                                  MaterialPageRoute(
                                      builder: (context) => ProfilePage()),
                                );
                              })),
                      Padding(
                        padding: EdgeInsets.only(left: 10),
                      ),
                      Align(
                          child: FloatingActionButton.extended(
                              splashColor: Color(0xFFFF1170),
                              backgroundColor: Color(0xFFFF1170),
                              heroTag: "searchBtn",
                              icon: Icon(Icons.search),
                              label: Text("חיפוש",
                                  style:
                                      TextStyle(fontWeight: FontWeight.w800)),
                              onPressed: () {
                                Navigator.push(
                                  context,
                                  MaterialPageRoute(
                                      builder: (context) => SearchPage()),
                                );
                              })),
                    ],
                  ),
                  Padding(
                    padding: EdgeInsets.only(bottom: 10),
                  ),
                ],
              ),
            ),
          )
        ],
      ),
    );
  }
}```

Thanks :)
flutter
apk
asked on Stack Overflow Jun 20, 2020 by LiamRahum

1 Answer

1

I think you are missing Internt permission.

Goto Android file > app > src > main > Open AndroidMenifestFile and under <manifest Tag add this code

<uses-permission android:name="android.permission.INTERNET"/>

answered on Stack Overflow Jun 20, 2020 by ismail

User contributions licensed under CC BY-SA 3.0