main_auth 0.0.2 main_auth: ^0.0.2 copied to clipboard
This package provides a customizable **Login** and **Sign-Up** screen for Flutter applications. It allows easy integration of login forms, social login buttons, and customization of titles, styles, an [...]
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:main_auth/main_auth.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
supportedLocales: const [
Locale('en'),
Locale('ar'),
],
locale: const Locale('ar'),
localeResolutionCallback: (locale, supportedLocales) =>
locale ?? const Locale('ar'),
localizationsDelegates: const [
ValidationLocalizations.delegate,
AuthLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate
],
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return LoginScreen(
loginType: LoginType.phone,
authTypesList: const [
AuthType.apple,
AuthType.google,
],
onTapFacebook: () => log('facebook'),
onTapGoogle: () => log('google'),
onTapApple: () => log('apple'),
onTapX: () => log('x'),
onLoginPressed: (email, password) => log('$email, $password,'),
);
}
}