We have an application that already publish in Google Playstore
Before publish, we have already tested the application to make sure everything is alright
After the application publish, the application can’t run, only in splash screen, and then everything is white
This is should application view after Splashscreen
This is application login page
import 'dart:math';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_chat_ui/flutter_chat_ui.dart';
import 'package:sipuan_app/latihan/cobacustomlogin.dart';
import 'package:sipuan_app/model/model.dart';
import 'package:sipuan_app/screen/beranda.dart';
import 'package:sipuan_app/screen/launcher.dart';
import 'package:sipuan_app/screen/loadingchatscreen.dart';
import 'package:sipuan_app/screen/registerpage.dart';
class LoginPage extends StatefulWidget {
const LoginPage({super.key});
@override
State<LoginPage> createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
bool lihat = false;
List<Map> searchResult = [];
bool circularlihat = true;
TextEditingController noktp = TextEditingController();
TextEditingController password = TextEditingController();
TextEditingController lupaemail = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
body: SingleChildScrollView(
child: Stack(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width / 1,
height: MediaQuery.of(context).size.height / 0.5,
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomCenter,
tileMode: TileMode.clamp,
colors: [
Color.fromARGB(255, 255, 128, 167),
Color.fromARGB(255, 171, 201, 255)
],
),
),
),
Positioned(
child: Container(
width: MediaQuery.of(context).size.width / 1,
height: MediaQuery.of(context).size.height / 1,
child: Stack(children: [
Positioned(
left: -MediaQuery.of(context).size.width / 1,
top: 0,
bottom: 0,
child: Container(
width: MediaQuery.of(context).size.height / 1,
height: MediaQuery.of(context).size.height / 1,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color.fromARGB(255, 238, 27, 143),
),
),
),
Positioned(
left: -MediaQuery.of(context).size.width / 1,
top: 0,
bottom: 0,
child: Container(
width: MediaQuery.of(context).size.height / 1.1,
height: MediaQuery.of(context).size.height / 1.1,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color.fromARGB(255, 255, 71, 172),
),
),
),
Positioned(
left: -MediaQuery.of(context).size.width / 1,
top: 0,
bottom: 0,
child: Container(
width: MediaQuery.of(context).size.height / 1.2,
height: MediaQuery.of(context).size.height / 1.2,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color.fromARGB(255, 214, 97, 162),
),
),
),
Positioned(
left: -MediaQuery.of(context).size.width / 1,
top: 0,
bottom: 0,
child: Container(
width: MediaQuery.of(context).size.height / 1.3,
height: MediaQuery.of(context).size.height / 1.3,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color.fromARGB(255, 235, 167, 204),
),
),
),
Positioned(
left: -MediaQuery.of(context).size.width / 1,
top: 0,
bottom: 0,
child: Hero(
tag: 'duapuluh',
child: Container(
width: MediaQuery.of(context).size.height / 1.4,
height: MediaQuery.of(context).size.height / 1.4,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color.fromARGB(255, 235, 175, 196),
),
),
),
),
]),
)),
SingleChildScrollView(
child: Positioned(
left: 0,
right: 0,
top: MediaQuery.of(context).size.height / 6,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: MediaQuery.of(context).size.height / 7,
),
Container(
height: MediaQuery.of(context).size.width / 6,
child: Image.asset("assets/foto2.png"),
),
SizedBox(
height: MediaQuery.of(context).size.height / 24,
),
const Text(
"Login",
style: TextStyle(
color: Colors.white,
fontSize: 35,
fontWeight: FontWeight.w900),
),
Padding(
padding: EdgeInsets.only(
left: MediaQuery.of(context).size.width / 10,
right: MediaQuery.of(context).size.width / 10,
top: MediaQuery.of(context).size.width / 20,
),
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
color: const Color.fromARGB(144, 255, 255, 255),
borderRadius: BorderRadius.circular(0)),
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(
left: 10, right: 10, top: 10),
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(left: 10),
child: Align(
child: ShaderMask(
shaderCallback: (Rect bounds) {
return LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomRight,
colors: [
Color.fromARGB(255, 67, 121, 223),
Color.fromARGB(
255, 240, 122, 157),
],
tileMode: TileMode.mirror,
).createShader(bounds);
},
child: const Text(
"NIK",
style: TextStyle(
fontSize: 20,
color: Color.fromARGB(
255, 255, 255, 255),
fontWeight: FontWeight.bold),
),
),
alignment: Alignment.centerLeft,
),
),
Container(
decoration: BoxDecoration(
gradient: const LinearGradient(
// Where the linear gradient begins and ends
begin: Alignment.topRight,
end: Alignment.bottomRight,
// tileMode: TileMode.mirror,
colors: [
Color.fromARGB(255, 67, 121, 223),
Color.fromARGB(255, 240, 122, 157),
],
),
borderRadius: BorderRadius.circular(0)),
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextField(
controller: noktp,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
disabledBorder: InputBorder.none,
contentPadding:
EdgeInsets.symmetric(
vertical: 2.0,
horizontal: 4.0,
),
border: OutlineInputBorder(
borderRadius: BorderRadius.only(
topRight: Radius.circular(0),
bottomRight:
Radius.circular(0)),
),
icon: Padding(
padding: EdgeInsets.only(
left: 4,
right: 0,
),
child: Icon(
Icons.email_outlined,
size: 30,
color: Colors.white,
),
),
filled: true,
fillColor: Colors.white,
hintText: "Ketikan Disini"),
),
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(
left: 10, right: 10, top: 10),
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(left: 10),
child: Align(
child: ShaderMask(
shaderCallback: (Rect bounds) {
return LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomRight,
colors: [
Color.fromARGB(255, 67, 121, 223),
Color.fromARGB(
255, 240, 122, 157),
],
tileMode: TileMode.mirror,
).createShader(bounds);
},
child: const Text(
"Kata Sandi",
style: TextStyle(
fontSize: 20,
color: Color.fromARGB(
255, 255, 255, 255),
fontWeight: FontWeight.bold),
),
),
alignment: Alignment.centerLeft,
),
),
Padding(
padding: const EdgeInsets.only(bottom: 20),
child: Container(
decoration: BoxDecoration(
gradient: const LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color.fromARGB(255, 67, 121, 223),
Color.fromARGB(255, 240, 122, 157),
],
),
borderRadius: BorderRadius.circular(0),
),
child: Padding(
padding: const EdgeInsets.all(4.0),
child: TextField(
controller: password,
obscureText: !lihat ? true : false,
decoration: InputDecoration(
disabledBorder: InputBorder.none,
contentPadding:
const EdgeInsets.symmetric(
vertical: 2.0,
horizontal: 4.0,
),
border: const OutlineInputBorder(
borderRadius: BorderRadius.only(
topRight: Radius.circular(0),
bottomRight:
Radius.circular(0)),
),
icon: const Padding(
padding: EdgeInsets.only(
left: 4,
right: 0,
),
child: Icon(
Icons.lock_outline_sharp,
size: 30,
color: Colors.white,
),
),
filled: true,
fillColor: Colors.white,
hintText: "Ketikan Disini",
suffixIcon: IconButton(
onPressed: () {
setState(() {
if (lihat) {
lihat = false;
} else {
lihat = true;
}
});
},
icon: !lihat
? Icon(Icons.remove_red_eye)
: Icon(Icons
.remove_red_eye_rounded),
),
),
),
),
),
),
Padding(
padding: const EdgeInsets.symmetric(
vertical: 20),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.transparent,
onSurface: Colors.transparent,
shadowColor: Colors.transparent,
),
onPressed: () async {
showDialog(
context: context,
builder: (context) {
return Center(
child: Visibility(
visible: circularlihat,
child:
CircularProgressIndicator()),
);
});
setState(() {
setState(() {
searchResult = [];
});
});
await FirebaseFirestore.instance
.collection('users')
.where("noktp",
isEqualTo: noktp.text)
.get()
.then((value) async {
if (value.docs.length < 1) {
Navigator.of(context,
rootNavigator: true)
.pop();
tampilsnackbarverifikasi(
context, "NIK tidak ditemukan");
return;
}
String aaa = value.docs.toString();
UserModellogin bbbb;
value.docs.forEach((user) async {
bbbb =
UserModellogin.fromJson(user);
print("login['email']");
print(bbbb.email);
print("login['email']");
try {
final user = (await FirebaseAuth
.instance
.signInWithEmailAndPassword(
email: bbbb.email,
password: password
.text
.trim()))
.user;
DocumentSnapshot userData =
await FirebaseFirestore
.instance
.collection("users")
.doc(user?.uid)
.get();
UserModel userModel =
UserModel.fromJson(userData);
print("objectasdasdas");
print(userModel.verif);
var verif = userModel.verif;
if (verif == '1') {
if (user != null) {
tampilsnackbarverifikasi(
context,
"Login Berhasil");
Navigator.of(context,
rootNavigator: true)
.pop();
Navigator.of(context).pop();
Navigator.of(context)
.pushAndRemoveUntil(
MaterialPageRoute(
builder: (context) =>
loadingpage()),
(Route<dynamic>
route) =>
false);
} else {}
} else {
tampilsnackbarverifikasi(
context,
"User anda belum di verifikasi admin");
FirebaseAuth.instance.signOut();
Navigator.of(context,
rootNavigator: true)
.pop();
}
} on FirebaseAuthException catch (e) {
Navigator.of(context).pop();
print(e);
if (e.toString() ==
"[firebase_auth/wrong-password] The password is invalid or the user does not have a password.") {
print("vdvdjfds");
tampilsnackbar(
context, "password salah");
}
tampilsnackbar(
context, e.toString());
}
});
print("login['email']");
print("login['email']");
});
},
child: Container(
height: 40,
width: 200,
decoration: BoxDecoration(
gradient: const LinearGradient(
// Where the linear gradient begins and ends
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
// tileMode: TileMode.clamp,
colors: [
Color.fromARGB(
255, 67, 121, 223),
Color.fromARGB(
255, 240, 122, 157),
],
),
borderRadius:
BorderRadius.circular(0)),
child: const Padding(
padding: EdgeInsets.symmetric(
horizontal: 30),
child: Center(
child: Text(
"MASUK",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
),
),
),
),
],
),
),
],
),
),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 50,
vertical: 10,
),
child: Container(
alignment: Alignment.center,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: ((context) =>
const RegisterPage()),
),
);
},
child: const Text(
"daftar akun",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
decoration: TextDecoration.underline,
),
),
),
],
),
),
)
],
),
),
),
],
),
),
);
}
}
We have tried to tracking the code and find what is the problem. But until now, we don't know what is the problem.
We expecting the application run smoothly, after splash screen to login page.
But that happened after splash screen, everything is blank in white.
2
Answers
In your project file
lib/screen/loginpage.dart
, you are usingPosition
in the child ofSingleChildScrollView
at line no.: 162. You have to removePosition
widget to solve this.Before
I hope this helps..
I have found out from your github code is that you are using Firebase and it is a service which requires Internet permission. As in debug mode it will work because the internet permission is added default, but for release version it won’t be there.
So, add the below code inside android/app/src/main/Androidmanifest.xml before or after tag. You can check for reference in debug Androidmanifest.xml file.
I hope it resolves your issue.