Мой apk flutter выглядит действительно странно по сравнению с тем, что я вижу, когда запускаю его? - PullRequest
1 голос
/ 16 июня 2020

Может кто-нибудь мне поможет разобраться? Вот как это выглядит в apk: 1

Вот как это выглядит в обычном эмуляторе: 2

Я использую Android Studio для кодирования

Код идеально подходит для создания второго изображения, я использовал firebase в качестве своей базы данных.

Кажется, я не могу выяснить, в чем причина проблемы.

Спасибо на ваше время.

import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:techstarter/alertdialog.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:techstarter/createaccountpage.dart';

import 'package:techstarter/homepage.dart';
import 'package:techstarter/testy.dart';

void main() {
  runApp(MyApp());
}

class firebasee{

  final _auth = FirebaseAuth.instance;
  final String _email;
  final String _password;
  static FirebaseUser user;
  static String email = "";



  var contextt;

  firebasee(this._email, this._password, this.contextt);


  Future reset() async{

    try{

    _auth.sendPasswordResetEmail(
      email: _email
    ).then((value) => testyAlert(contextt, "Email sent to ${_email}"));
    }
    catch(e){
      testyAlert(contextt, "Error occoured");
    }
  }


  Future sigin() async{
    try{
      final FirebaseUser user = (await _auth.createUserWithEmailAndPassword(
        email: _email,
        password: _password,
      )).user;
      email = user.email.toString();

      print(email);

      Navigator.push(
        contextt,
        MaterialPageRoute(
          builder: (contextt) => homepage(),
          settings: RouteSettings(
            arguments: email
          )
        )
      );



    }catch(e){
      print(e.toString());
      testyAlert(contextt, "Error creating account");
    }
  }
  Future signinm() async{
    try{
      final FirebaseUser user = (await _auth.signInWithEmailAndPassword(
        email: _email,
        password: _password,
      )).user;
      email = user.email.toString();

      //print(email);


      Navigator.push(
          contextt,
          MaterialPageRoute(
            builder: (context) => homepage(),
            settings: RouteSettings(
              arguments: email,
            ),
          )

      );

      //return email;
    }catch(e){
      print(e.toString());
      print('schinken');
      testyAlert(contextt, "Please enter a valid email or password");
    }
  }
  Future signinanon() async{
    try{
      final AuthResult result = await _auth.signInAnonymously();
      final FirebaseUser user = result.user;
      return FirebaseUser;
    }catch(e){
      print(e.toString());

    }
  }
}



class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: myApp(),
    );
  }
}

class myApp extends StatelessWidget {


  void changestarte(context){

    Navigator.push(
        context,
        MaterialPageRoute(
          builder: (context) => homepage(),
          settings: RouteSettings(
            arguments: em,
          ),
        )

    );
  }


  final String emailer = "email";


  final FirebaseAuth _auth = FirebaseAuth.instance;

  String _password;
  String em;
  String _email;
  final myController = TextEditingController();
  final newcontraellpw = TextEditingController();
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(

        body: Container(
          height: double.infinity,
          decoration: BoxDecoration(
            gradient: SweepGradient(
              center: AlignmentDirectional(1,-1),
              startAngle: 1.7,
              endAngle: 3,
              colors: [Colors.green[600], Colors.lightBlueAccent]
            )
          ),
          child: Center(
            child: ListView(
              children: <Widget>[
                Padding(
                  padding: const EdgeInsets.only(bottom: 25),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                    children: <Widget>[

                      Padding(
                          padding: const EdgeInsets.only(bottom: 4),
                          child: Container(
                            height: 145,
                            width: 145,
                            child: Image.asset(
                                "images/wwww.png"
                            ),
                          )
                      ),
                    ],
                  ),
                ),


                Padding(
                  padding: const EdgeInsets.only(left:25, right: 25),

                  child: Padding(
                    padding: const EdgeInsets.only(top:30),
                    child: ClipRRect(
                      borderRadius: BorderRadius.circular(15.0),
                      child: Container(
                        color: Colors.grey[100],
                        child: Column(
                          children: <Widget>[
                            Center(
                              child: Padding(
                                padding: const EdgeInsets.only(top: 10),
                                child: Text(
                                  "Email",
                                  style: TextStyle(
                                    fontFamily: 'Nunito',
                                    fontWeight: FontWeight.normal,
                                    fontSize: 25.0,
                                    letterSpacing: 1.3
                                  ),
                                ),
                              ),
                            ),
                            Padding(
                              padding: const EdgeInsets.only(top:20, left:35, right: 35),
                              child: Center(
                                child: TextField(
                                  controller: myController,
                                  textAlign: TextAlign.center,
                                  autocorrect: true,
                                  style: TextStyle(
                                      fontFamily: 'Nunito',
                                      fontSize: 15.0,
                                      letterSpacing: 1.1
                                  ),


                                ),
                              ),
                            ),
                            Center(
                              child: Flexible(
                                flex: 0,
                                child: Padding(
                                  padding: const EdgeInsets.only(top: 75),
                                  child: Text(
                                    "Password",
                                    style: TextStyle(
                                        fontFamily: 'Nunito',
                                        fontWeight: FontWeight.normal,
                                        fontSize: 25.0,
                                        letterSpacing: 1.3
                                    ),
                                  ),
                                ),
                              ),
                            ),
                            Flexible(
                              flex: 0,
                              child: Padding(
                                padding: const EdgeInsets.only(top:20, left:35, right: 35),
                                child: Center(
                                  child: TextField(
                                    controller: newcontraellpw,
                                    textAlign: TextAlign.center,
                                    autocorrect: true,
                                    obscureText: true,
                                    style: TextStyle(
                                        fontFamily: 'Nunito',
                                        fontSize: 15.0,
                                        letterSpacing: 1.1
                                    ),
                                  ),
                                ),
                              ),
                            ),
                          ],
                        ),
                        height: 320,
                      ),
                    ),
                  ),
                ),





                Padding(
                  padding: const EdgeInsets.only(top: 40),
                  child: FlatButton(
                    child: Text(
                      "Login",
                      style: TextStyle(
                        color: Colors.deepOrange[700],
                        fontSize: 23.0,
                        fontFamily: 'Berlin'
                      ),
                    ),
                    onPressed: () {
                      if (myController.text.isEmpty ||
                          newcontraellpw.text.isEmpty) {
                        testAlert(context);
                      } else {
                        try {

                          firebasee(myController.text,newcontraellpw.text,context).signinm().then((email) => em = email);

                        }catch(e){
                          print('Nouce');
                        }
                      }
                    }



                  ),
                ),
                Padding(
                  padding: const EdgeInsets.only(top:15),
                  child: FlatButton(
                      child: Text(
                        "Create Account",
                        style: TextStyle(
                            color: Colors.deepOrange[700],
                            fontSize: 23.0,
                            fontFamily: 'Berlin'
                        ),
                      ),
                      onPressed: () {
                        Navigator.push(
                            context, 
                            MaterialPageRoute(
                              builder: (context) => createaccountpage()
                            )
                        );

                      }
                  ),
                ),
                Padding(
                  padding: const EdgeInsets.only(top:10),
                  child: FlatButton(
                      child: Text(
                        "Reset Password",
                        style: TextStyle(
                            color: Colors.deepOrange[700],
                            fontSize: 23.0,
                            fontFamily: 'Berlin'
                        ),
                      ),
                      onPressed: () {
                        Navigator.push(
                            context,
                            MaterialPageRoute(
                                builder: (context) =>statefssduf()
                            )
                        );

                      }
                  ),
                )
              ],
        ),
          ),
      ),
      ),
    );
  }
}
class statefssduf extends StatefulWidget{
  @override
  resetpassword createState() => resetpassword();
}
class resetpassword extends State<statefssduf>{

  final te = TextEditingController();
  final mAuht = FirebaseAuth.instance;
  double height = 100;
  int index =0 ;


  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      home: Scaffold(
        body: Container(
          decoration: BoxDecoration(
              gradient: SweepGradient(
                  center: AlignmentDirectional(1,-1),
                  startAngle: 1.7,
                  endAngle: 3,
                  colors: [Colors.green[600], Colors.lightBlueAccent]
              )
          ),
          child: ListView(
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.all(50),
                child: Center(
                  child: Padding(
                    padding:const EdgeInsets.only(top: 200),
                    child: ClipRRect(
                      borderRadius: BorderRadius.circular(15.0),
                      child:Container(


                        height: 220,
                        color: Colors.white,

                        child: Column(
                          children: <Widget>[
                            Padding(
                              padding: const EdgeInsets.all(22),
                              child: TextField(
                                decoration: InputDecoration(
                                  hintText: "Input your email"
                                ),
                                style: TextStyle(
                                  color: Colors.black,
                                  fontFamily: 'Nunito',
                                  fontSize: 20.0
                                ),
                                controller: te,
                                onTap: (){
                                  testyAlert(context, "If no confirmation popup appear, please enter a valid email");
                                },

                                  //

                              ),
                            ),
                            Padding(
                              padding: const EdgeInsets.fromLTRB(0,40,0, 15),
                              child: FlatButton(
                                child: Text(
                                  "Send reset email",
                                  style: TextStyle(
                                      color: Colors.black,
                                      fontFamily: 'Nunito',
                                      fontSize: 12.0
                                  ),

                                ),
                                onPressed: (){
                                  if(te.text.isEmpty){
                                    testyAlert(context, "Please enter an email");
                                  }else{
                                    try {
                                      firebasee(te.text.toString(), "", context)
                                          .reset();
                                    }catch(e){
                                      testyAlert(context, "Error Occoured");
                                    }
                                  }

                                },
                              ),
                            )

                          ],
                        ),
                      ),
                    ),
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );

  }
}
...