mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2026-08-25 01:05:36 +00:00
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
This commit is contained in:
23
firebase_google_authentication/analysis_options.yaml
Normal file
23
firebase_google_authentication/analysis_options.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
# Lint rules for Flutter apps.
|
||||
# See https://dart.dev/guides/language/analysis-options
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
exclude:
|
||||
- build/**
|
||||
- android/**
|
||||
- ios/**
|
||||
- web/**
|
||||
- windows/**
|
||||
- macos/**
|
||||
- linux/**
|
||||
|
||||
linter:
|
||||
rules:
|
||||
# Noise in small sample apps; keep the code readable.
|
||||
avoid_print: false
|
||||
avoid_unnecessary_containers: false
|
||||
file_names: false
|
||||
library_private_types_in_public_api: false
|
||||
non_constant_identifier_names: false
|
||||
strict_top_level_inference: false
|
||||
@@ -5,6 +5,7 @@
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name="io.flutter.embedding.android.FlutterActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
const HomePage({Key? key}) : super(key: key);
|
||||
const HomePage({super.key});
|
||||
|
||||
@override
|
||||
_HomePageState createState() => _HomePageState();
|
||||
@@ -62,7 +62,7 @@ class _HomePageState extends State<HomePage> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
SizedBox(
|
||||
width: size.width * 0.8,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(29),
|
||||
@@ -92,7 +92,7 @@ class _HomePageState extends State<HomePage> {
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Container(
|
||||
SizedBox(
|
||||
width: size.width * 0.8,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(29),
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class InfoPage extends StatefulWidget {
|
||||
const InfoPage({Key? key}) : super(key: key);
|
||||
const InfoPage({super.key});
|
||||
|
||||
@override
|
||||
_InfoPageState createState() => _InfoPageState();
|
||||
@@ -53,7 +53,7 @@ class _InfoPageState extends State<InfoPage> {
|
||||
height: 15,
|
||||
),
|
||||
Text(
|
||||
user!.email ?? '',
|
||||
user.email ?? '',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -7,23 +7,28 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class SignUpPage extends StatefulWidget {
|
||||
bool isLogin;
|
||||
SignUpPage(this.isLogin);
|
||||
final bool isLogin;
|
||||
const SignUpPage(this.isLogin, {super.key});
|
||||
@override
|
||||
_SignUpPageState createState() => _SignUpPageState(isLogin);
|
||||
State<SignUpPage> createState() => _SignUpPageState();
|
||||
}
|
||||
|
||||
class _SignUpPageState extends State<SignUpPage> {
|
||||
bool isLogin;
|
||||
_SignUpPageState(this.isLogin);
|
||||
late bool isLogin;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
isLogin = widget.isLogin;
|
||||
}
|
||||
|
||||
bool loggingIn = false;
|
||||
TextEditingController email = new TextEditingController();
|
||||
TextEditingController password = new TextEditingController();
|
||||
TextEditingController email = TextEditingController();
|
||||
TextEditingController password = TextEditingController();
|
||||
bool showPassword = false;
|
||||
|
||||
void showSnackBar() {
|
||||
final snackBar = new SnackBar(
|
||||
final snackBar = SnackBar(
|
||||
content: Text('Invalid Credentials!'),
|
||||
backgroundColor: Colors.red,
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
@@ -40,7 +45,7 @@ class _SignUpPageState extends State<SignUpPage> {
|
||||
final Size size = MediaQuery.of(context).size;
|
||||
return Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
child: SizedBox(
|
||||
height: size.height,
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
@@ -136,7 +141,7 @@ class _SignUpPageState extends State<SignUpPage> {
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Container(
|
||||
SizedBox(
|
||||
width: size.width * 0.8,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(29),
|
||||
@@ -147,11 +152,11 @@ class _SignUpPageState extends State<SignUpPage> {
|
||||
backgroundColor: Color(0xFF6F35A5),
|
||||
),
|
||||
onPressed: () {
|
||||
String _email = email.text;
|
||||
String _password = password.text;
|
||||
String emailText = email.text;
|
||||
String passwordText = password.text;
|
||||
!(isLogin)
|
||||
? signUpClicked(_email, _password, context)
|
||||
: loginClicked(_email, _password, context);
|
||||
? signUpClicked(emailText, passwordText, context)
|
||||
: loginClicked(emailText, passwordText, context);
|
||||
},
|
||||
child: Text(
|
||||
(isLogin) ? 'Login' : 'SignUp',
|
||||
@@ -166,7 +171,7 @@ class _SignUpPageState extends State<SignUpPage> {
|
||||
SizedBox(
|
||||
height: 18,
|
||||
),
|
||||
Container(
|
||||
SizedBox(
|
||||
width: size.width * 0.81,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(29),
|
||||
@@ -181,6 +186,7 @@ class _SignUpPageState extends State<SignUpPage> {
|
||||
context,
|
||||
listen: false);
|
||||
provider.googleLogin().then((value) {
|
||||
if (!context.mounted) return;
|
||||
Navigator.popUntil(
|
||||
context, (route) => route.isFirst);
|
||||
}).catchError((onError) {
|
||||
@@ -242,14 +248,15 @@ class _SignUpPageState extends State<SignUpPage> {
|
||||
);
|
||||
}
|
||||
|
||||
signUpClicked(String _email, String _password, BuildContext context) {
|
||||
void signUpClicked(String email, String password, BuildContext context) {
|
||||
FirebaseAuth.instance
|
||||
.createUserWithEmailAndPassword(email: _email, password: _password)
|
||||
.createUserWithEmailAndPassword(email: email, password: password)
|
||||
.then((value) {
|
||||
setState(() {
|
||||
loggingIn = true;
|
||||
});
|
||||
Future.delayed(Duration(seconds: 1, milliseconds: 50), () {
|
||||
if (!context.mounted) return;
|
||||
Navigator.popUntil(context, (route) => route.isFirst);
|
||||
});
|
||||
}).catchError((e) {
|
||||
@@ -257,14 +264,15 @@ class _SignUpPageState extends State<SignUpPage> {
|
||||
});
|
||||
}
|
||||
|
||||
bool loginClicked(String _email, String _password, BuildContext context) {
|
||||
bool loginClicked(String email, String password, BuildContext context) {
|
||||
FirebaseAuth.instance
|
||||
.signInWithEmailAndPassword(email: _email, password: _password)
|
||||
.signInWithEmailAndPassword(email: email, password: password)
|
||||
.then((value) {
|
||||
setState(() {
|
||||
loggingIn = true;
|
||||
});
|
||||
Future.delayed(Duration(seconds: 1, milliseconds: 50), () {
|
||||
if (!context.mounted) return;
|
||||
Navigator.pop(context);
|
||||
});
|
||||
}).catchError((e) {
|
||||
|
||||
@@ -15,10 +15,9 @@ class GoogleSignInProvider extends ChangeNotifier {
|
||||
try {
|
||||
await googleSignIn.initialize();
|
||||
final googleUser = await googleSignIn.authenticate();
|
||||
if (googleUser == null) return;
|
||||
_user = googleUser;
|
||||
|
||||
final googleAuth = await googleUser.authentication;
|
||||
final googleAuth = googleUser.authentication;
|
||||
|
||||
final credentials = GoogleAuthProvider.credential(
|
||||
idToken: googleAuth.idToken,
|
||||
|
||||
@@ -11,7 +11,7 @@ void main() async{
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -40,6 +40,7 @@ dependencies:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^6.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
Reference in New Issue
Block a user