1
0
mirror of https://github.com/nisrulz/flutter-examples.git synced 2026-08-24 16:50:47 +00:00
Files
flutter-examples/firebase_google_authentication/lib/Screens/HomePage.dart
Nishant Srivastava 5c53498119 refactor: standardize Dart and Android config across all 54 apps
- Bump all apps to sdk >=3.0.0 <4.0.0 and add flutter_lints + a shared
  analysis_options.yaml to every app (flutter analyze is now green repo-wide)
- Fix real compile errors in firebase_google_authentication and image_editor,
  plus deprecated APIs (Matrix4, SvgPicture.color, textScaleFactor),
  missing async 'mounted' guards, and misc lints via dart fix + manual fixes
- Align pubspec 'name' with each folder and Android namespace/applicationId
  with the documented github.nisrulz.* convention
- Convert bmi_calculator from a legacy Flutter module to a standard app
  with a proper android/ scaffold; fix missing android:exported in launcher
  manifests across 22 apps so all Android builds pass
- Untrack generated build files (GeneratedPluginRegistrant,
  .flutter-plugins-dependencies) and ignore them
2026-08-17 17:26:39 +02:00

121 lines
3.6 KiB
Dart

import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_google_authentication/Screens/InfoPage.dart';
import 'package:firebase_google_authentication/Screens/SignUpPage.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_fonts/google_fonts.dart';
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
return Scaffold(
body: StreamBuilder(
stream: FirebaseAuth.instance.authStateChanges(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: CircularProgressIndicator(),
);
} else if (snapshot.hasError) {
return Center(
child: Text('An error Occured!!'),
);
} else if (snapshot.hasData) {
return InfoPage();
} else {
return home(size, context);
}
}),
);
}
Column home(Size size, BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Welcome!',
style: GoogleFonts.lora(
fontSize: 36,
fontWeight: FontWeight.w500,
),
),
SizedBox(
height: 30,
),
SvgPicture.asset(
'assets/login.svg',
width: size.width * 0.8,
height: size.height * 0.3,
),
SizedBox(
height: 60,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: size.width * 0.8,
child: ClipRRect(
borderRadius: BorderRadius.circular(29),
child: TextButton(
style: TextButton.styleFrom(
padding:
EdgeInsets.symmetric(vertical: 15, horizontal: 40),
backgroundColor: Color(0xFF6F35A5)),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => SignUpPage(true)));
},
child: Text(
'Login',
style: GoogleFonts.alice(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
),
),
],
),
SizedBox(
height: 15,
),
SizedBox(
width: size.width * 0.8,
child: ClipRRect(
borderRadius: BorderRadius.circular(29),
child: TextButton(
style: TextButton.styleFrom(
padding: EdgeInsets.symmetric(vertical: 15, horizontal: 40),
backgroundColor: Color(0xFFF1E6FF)),
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => SignUpPage(false)));
},
child: Text(
'SignUp',
style: GoogleFonts.alice(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
),
),
],
);
}
}