179 lines
4.5 KiB
Dart
179 lines
4.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get_it/get_it.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:sign_button/sign_button.dart';
|
|
import 'package:Rabbit_Habit/config/constraint.dart';
|
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|
|
|
final GetIt getIt = GetIt.instance;
|
|
final tr = getIt.get<AppLocalizations>();
|
|
const List<Widget> screenContent = [
|
|
WelcomeToPicture(),
|
|
WelcomeToText(),
|
|
SizedBox(
|
|
height: 25,
|
|
),
|
|
BrandQuoteText(),
|
|
SignInButtons(),
|
|
|
|
];
|
|
|
|
class LoginScreen extends StatelessWidget {
|
|
const LoginScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
ThemeData themeData = Theme.of(context);
|
|
return Scaffold(
|
|
backgroundColor: themeData.colorScheme.background,
|
|
body: SafeArea(
|
|
child: Center(
|
|
child: MediaQuery.of(context).size.height > 500
|
|
? const Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: screenContent,
|
|
)
|
|
: ListView(
|
|
children: screenContent,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
class WelcomeToPicture extends StatelessWidget {
|
|
const WelcomeToPicture({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
AssetImage rabbitAsset = AssetImage('images/rabbit.png');
|
|
Image image = Image(image: rabbitAsset, width: 400, height: 400);
|
|
return Container(
|
|
child: image,
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
class WelcomeToText extends StatelessWidget {
|
|
const WelcomeToText({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final themeData = Theme.of(context);
|
|
|
|
return Column(
|
|
children: [
|
|
Padding(
|
|
padding: defaultTopPadding,
|
|
child: Text(
|
|
tr.welcome_to,
|
|
style: themeData.textTheme.bodyMedium?.copyWith(
|
|
color: themeData.colorScheme.outline,
|
|
fontSize: 30,
|
|
),
|
|
),
|
|
),
|
|
Text(
|
|
tr.app_name,
|
|
style: TextStyle(
|
|
fontFamily: 'Montserrat',
|
|
color: Colors.blue,
|
|
height: 1,
|
|
fontSize: 50,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class BrandQuoteText extends StatelessWidget {
|
|
const BrandQuoteText({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final themeData = Theme.of(context);
|
|
final brandQuoteTextStyle = themeData.textTheme.bodyMedium?.copyWith(
|
|
color: themeData.colorScheme.outline,
|
|
fontSize: 25,
|
|
);
|
|
final betterLifeTextStyle = themeData.textTheme.bodyMedium?.copyWith(
|
|
color: Colors.blue,
|
|
fontWeight: FontWeight.bold,
|
|
decorationThickness: 0.5,
|
|
decorationColor: themeData.colorScheme.primary,
|
|
fontSize: 25,
|
|
);
|
|
|
|
return Padding(
|
|
padding: defaultHorizontalViewPadding,
|
|
child: RichText(
|
|
textAlign: TextAlign.center,
|
|
text: TextSpan(
|
|
text: tr.auth_brand_quote_text1,
|
|
style: brandQuoteTextStyle,
|
|
children: [
|
|
TextSpan(
|
|
text: tr.for_a_better_life,
|
|
style: betterLifeTextStyle,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
} // D:\studiNerd\Operation WTF went wrong\CPD\Rabbit_Habit\ios\Runner\Assets.xcassets\AppIcon.appiconset
|
|
}
|
|
|
|
class SignInCustomButton extends StatelessWidget {
|
|
final ButtonType type;
|
|
final Function() onPressed;
|
|
const SignInCustomButton(
|
|
{super.key, required this.type, required this.onPressed});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SignInButton(
|
|
buttonType: type,
|
|
buttonSize: ButtonSize.medium,
|
|
onPressed: onPressed,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class SignInButtons extends StatelessWidget {
|
|
const SignInButtons({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final themeData = Theme.of(context);
|
|
|
|
return Column(
|
|
children: [
|
|
Padding(
|
|
padding: defaultTopPadding,
|
|
child: InkWell(
|
|
onTap: () {
|
|
context.go('/home');
|
|
},
|
|
child: Text(
|
|
tr.continue_to_sign,
|
|
style: themeData.textTheme.bodyMedium?.copyWith(
|
|
color: themeData.colorScheme.outline,
|
|
fontSize: 15,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|