aagnia_base_package 0.0.2 copy "aagnia_base_package: ^0.0.2" to clipboard
aagnia_base_package: ^0.0.2 copied to clipboard

discontinued
outdated

Flutter base component. Which is include all the basic screen and the details. If the user import the package they will use all the basic needs.

example/lib/main.dart

import 'dart:async';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'Screen/SplashScreen.dart';
import 'package:example/Screen/SignUpScreen.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runZoned<Future<void>>(() async {
    runApp(new MyApp());
  });
}

class MyApp extends StatelessWidget {
  //var fsconnect = FirebaseFirestore.instance;
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.deepPurple,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: SplashScreen(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  static String user_name = "";
  static String user_email = "";
  static bool user_emailVerified = false;
  static String user_imageUrl = "";
  static String user_token = "";
  static String user_uid = "";

  Future<String> isLoggedIn() async {
    await getPrefs();
  }

  final routes = <String, WidgetBuilder>{
    /* SignUpScreen.tag: (BuildContext context) => SignUpScreen(),
    DashBoardScreen.tag: (BuildContext context) => DashBoardScreen(),*/
  };

  static Future getPrefs() async {
    //Store the shared pref value here

    user_name = SignUpScreenState.user_name;
    if(user_name!=null){
      print("Login");
    }
    else{
      print("Login not");
    }
  }

  @override
  Widget build(BuildContext context) {
    return new FutureBuilder(
        future: isLoggedIn(),
        builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
          switch (snapshot.connectionState) {
            case ConnectionState.waiting:
              return Center(child: new Container());
            default:
              if (snapshot.hasError)
                return new Text('Error: ${snapshot.error}');
              else {
                return MaterialApp(
                  debugShowCheckedModeBanner: false,
                  theme: ThemeData.light().copyWith(
                      primaryColor: Colors.green,
                      primaryColorDark: Colors.green,
                      textTheme: Theme.of(context)
                          .textTheme
                          .apply(fontFamily: 'NotoSans')),
                  home: getHomeWidget(),
                  routes: routes,
                );
              }
          }
        });
  }

  Widget getHomeWidget() {
    /*if (AUTH_TOKEN_VALUE == null) {
      IS_PRE_LOGIN = true;
      return new Login();
    } else {
      IS_PRE_LOGIN = false;
      return new MyBaseScreen();
      //return new MyHomePage();
    }*/

    return SplashScreen();
  }
}
2
likes
0
pub points
0%
popularity

Publisher

verified publisheraagnia.com

Flutter base component. Which is include all the basic screen and the details. If the user import the package they will use all the basic needs.

Repository (GitLab)
View/report issues

License

unknown (license)

Dependencies

code_fields, country_code_picker, flutter, flutter_svg, scrolling_page_indicator

More

Packages that depend on aagnia_base_package