Skip to content

Commit

Permalink
refactor: code refactor and added routes
Browse files Browse the repository at this point in the history
  • Loading branch information
TikuGaelle committed Mar 16, 2023
1 parent e22c31f commit 3024645
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 152 deletions.
2 changes: 0 additions & 2 deletions lib/contact_us/contact_us_page.dart

This file was deleted.

2 changes: 2 additions & 0 deletions lib/contact_us/contact_us_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export 'view/contact_us_screen.dart';
export 'view/contact_us_success_screen.dart';
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
// ignore_for_file: body_might_complete_normally_nullable

import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:fpb/assets/fpb_svg.dart';
import 'package:fpb/contact_us/contact_us_page.dart';
import 'package:fpb/contact_us/contact_us_screen.dart';
import 'package:fpb/contact_us/view/widgets/message_textfield.dart';
import 'package:fpb/core/presentation/widget/fpb_button.dart';
import 'package:fpb/core/presentation/widget/fpb_text_form_field.dart';
import 'package:fpb/core/shared/helpers/extensions.dart';
import 'package:fpb/l10n/l10n.dart';
import 'package:fpb/router/app_route.gr.dart';
import 'package:fpb/sign_in/view/sign_in_page.dart';

class ContactUsPage extends StatefulWidget {
const ContactUsPage({super.key});
class ContactUsScreen extends StatefulWidget {
const ContactUsScreen({super.key});

@override
State<ContactUsPage> createState() => _ContactUsPageState();
State<ContactUsScreen> createState() => _ContactUsScreenState();
}

class _ContactUsPageState extends State<ContactUsPage> {
class _ContactUsScreenState extends State<ContactUsScreen> {
final _formKey = GlobalKey<FormState>();
final nameController = TextEditingController();
final emailController = TextEditingController();
Expand Down Expand Up @@ -145,14 +147,8 @@ class _ContactUsPageState extends State<ContactUsPage> {
label: l10n.contactUsSubmitBtnLabel,
onTap: () {
if (_formKey.currentState!.validate()) {
Navigator.of(context).push(
// ignore: inference_failure_on_instance_creation
MaterialPageRoute(
builder: (context) =>
ContactUsSuccessPage(
box: box,
),
),
context.router.push(
ContactUsSuccessRoute()
);
} else {}
})
Expand Down
77 changes: 0 additions & 77 deletions lib/contact_us/view/contact_us_success_page.dart

This file was deleted.

79 changes: 79 additions & 0 deletions lib/contact_us/view/contact_us_success_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import 'package:flutter/material.dart';
import 'package:fpb/assets/fpb_svg.dart';
import 'package:fpb/contact_us/view/widgets/contact_us_success_btn.dart';
import 'package:fpb/contact_us/view/widgets/contact_us_success_image.dart';
import 'package:fpb/contact_us/view/widgets/contact_us_success_texts.dart';
import 'package:fpb/l10n/l10n.dart';
import 'package:fpb/sign_in/view/sign_in_page.dart';

class ContactUsSuccessScreen extends StatelessWidget {
const ContactUsSuccessScreen({super.key, });

@override
Widget build(BuildContext context) {
final l10n = context.l10n;
final theme = Theme.of(context);
final style = theme.textTheme;
//final colors = theme.colorScheme;

return LayoutBuilder(
builder: (context, box){
return Scaffold(
resizeToAvoidBottomInset: false,
body: Stack(children: [
BubblesTopBackGround(
cts: box,
svgName: SvgNames.authBackground,
),
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: box.maxHeight * .75,
width: box.maxWidth,
decoration: BoxDecoration(
color: theme.colorScheme.background,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
),
),
child: Padding(
padding: EdgeInsets.only(
top: box.maxHeight * .025,
left: box.maxHeight * .025,
right: box.maxHeight * .025,
bottom: box.maxHeight * .005),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,

children: [
SizedBox(
height: box.maxHeight * .1,
),
ContactUsSuccessImageWidget(box: box),
SizedBox(
height: box.maxHeight * .0001,
),
ContactUsSuccessTexts(

l10n: l10n, style: style, box: box),
SizedBox(
height: box.maxHeight * .15,
),
ContactUsSuccessBtn(
style: style,
box: box,
backgroundColor: theme.colorScheme.background,
borderColor: theme.colorScheme.secondary,
text: l10n.contactUsSuccessBtnText,
textColor: theme.colorScheme.secondary,
)
],
),
),
))
]),
);
});
}
}
11 changes: 9 additions & 2 deletions lib/router/app_route.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:auto_route/annotations.dart';
import 'package:fpb/contact_us/view/contact_us_page.dart';
import 'package:fpb/contact_us/contact_us_page.dart';
import 'package:fpb/contact_us/view/contact_us_screen.dart';
import 'package:fpb/email_confirmation/email_confirmation.dart';
import 'package:fpb/home/view/home_screen.dart';
import 'package:fpb/latest_activities/view/latest_activities_screen.dart';
Expand All @@ -15,7 +16,7 @@ import 'package:fpb/sign_up/view/signup_page.dart';
@MaterialAutoRouter(
replaceInRouteName: 'Screen,Route',
routes: <AutoRoute>[
AutoRoute(page: ContactUsPage, initial: true),
AutoRoute(page: SplashScreen, initial: true),
AutoRoute(page: SignInScreen),
AutoRoute(page: PhoneNumberConfirmationScreen),
AutoRoute(page: EmailConfirmationScreen),
Expand All @@ -39,6 +40,12 @@ import 'package:fpb/sign_up/view/signup_page.dart';
page: QrCodeScreen,
),
AutoRoute(page: OnboardingScreen),
AutoRoute(
page: ContactUsScreen,
),
AutoRoute(
page: ContactUsSuccessScreen,
)
],
)
class $AppRoute {}
Loading

0 comments on commit 3024645

Please sign in to comment.