Skip to content

Commit

Permalink
notification
Browse files Browse the repository at this point in the history
  • Loading branch information
mo7amedaliEbaid committed Dec 22, 2023
1 parent 842ea94 commit c7a9d3c
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 34 deletions.
8 changes: 8 additions & 0 deletions lib/core/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class MyApp extends StatelessWidget {
create: (context) => di.sl<ShareCubit>(),
),
BlocProvider(
lazy: false,
create: (context) => di.sl<NotificationsCubit>()..init(),
),
],
Expand All @@ -94,6 +95,13 @@ class MyApp extends StatelessWidget {
),
),
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: OutlinedButton.styleFrom(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.zero,
),
)
),
iconTheme: const IconThemeData(color: AppColors.CommonCyan, size: 30),
floatingActionButtonTheme: const FloatingActionButtonThemeData(
backgroundColor: AppColors.CommonCyan,
Expand Down
4 changes: 2 additions & 2 deletions lib/core/router/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import '../error/exceptions.dart';
sealed class AppRouter {
static const String splash = '/';
static const String ads = '/ads';
static const String mainscreen = '/mainscreen';
static const String root = '/root';
static const String productDetails = '/product-details';
static const String search = '/search';
static const String filter = '/filter';
Expand All @@ -50,7 +50,7 @@ sealed class AppRouter {
return MaterialPageRoute(builder: (_) => const SplashScreen());
case ads:
return MaterialPageRoute(builder: (_) => const AdsScreen());
case mainscreen:
case root:
return MaterialPageRoute(builder: (_) => const RootScreen());
case search:
return MaterialPageRoute(builder: (_) => const SearchScreen());
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/screens/addresses.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class _AdressScreenState extends State<AdressScreen> {
padding: Space.all(1.2, 1),
child: Column(
children: [
TransparentButton(
transparentButton(
context: context,
onTap: () {
Navigator.of(context).pushNamed(AppRouter.addadress);
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/screens/ads.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AdsScreen extends StatelessWidget {
child: ElevatedButton(
onPressed: () {
Navigator.of(context).pushNamedAndRemoveUntil(
AppRouter.mainscreen,
AppRouter.root,
(route) => false,
);
},
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/screens/checkout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class _CheckOutScreenState extends State<CheckOutScreen> {
style: TextStyle(height: 1.6),
),
Space.yf(1.8),
TransparentButton(
transparentButton(
context: context,
onTap: () {
Navigator.of(context)
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/screens/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class _LoginScreenState extends State<LoginScreen> {
),
),
Space.y1!,
TransparentButton(
transparentButton(
context: context,
onTap: () {
Navigator.of(context).pushNamed(AppRouter.signup);
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/screens/order_success.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class _OrderSuccessScreenState extends State<OrderSuccessScreen> {
.updateTab(NavigationTab.homeTab);*/
context.read<CartBloc>().add(const ClearCart());
Navigator.of(context).pushNamedAndRemoveUntil(
AppRouter.mainscreen,
AppRouter.root,
(route) => false,
);
},
Expand Down
4 changes: 1 addition & 3 deletions lib/presentation/screens/root.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import 'package:piiicks/configs/app.dart';
import 'package:piiicks/core/constant/colors.dart';
import 'package:piiicks/presentation/screens/cart.dart';
import 'package:piiicks/presentation/screens/categories.dart';
import 'package:piiicks/presentation/screens/filter.dart';
import 'package:piiicks/presentation/screens/home.dart';
import 'package:piiicks/presentation/screens/products_list.dart';
import 'package:piiicks/presentation/screens/profile.dart';
import 'package:piiicks/presentation/screens/signup.dart';
import 'package:piiicks/presentation/widgets/bottom_navbar.dart';

import '../../application/bottom_navbar_cubit/bottom_navbar_cubit.dart';
Expand Down Expand Up @@ -62,7 +60,7 @@ class RootScreen extends StatelessWidget {
return WillPopScope(
onWillPop: _onWillPop,
child: Scaffold(
bottomNavigationBar: BottomNavigation(),
bottomNavigationBar: const BottomNavigation(),
body: Center(
child: BlocBuilder<NavigationCubit, NavigationTab>(
builder: (context, activeTab) {
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/screens/signup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class _SignUpScreenState extends State<SignUpScreen> {
style: AppText.b1b,
)),
Space.y1!,
TransparentButton(
transparentButton(
context: context,
onTap: () {
Navigator.of(context).pushNamed(AppRouter.login);
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/widgets/auth_check_modalsheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Future<void> showAuthCheckModalSheet(BuildContext context) {
)),
),
Space.yf(),
TransparentButton(
transparentButton(
context: context,
onTap: () {},
buttonText: "Continue as a Guest")
Expand Down
28 changes: 27 additions & 1 deletion lib/presentation/widgets/custom_textfield.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import '../../core/constant/colors.dart';

import 'package:flutter/material.dart';

Widget buildTextFormField(TextEditingController controller, String labelText,

/*Widget buildTextFormField(TextEditingController controller, String labelText,
{bool isObscure=false}) {
return Container(
height: AppDimensions.normalize(20),
Expand Down Expand Up @@ -32,4 +33,29 @@ Widget buildTextFormField(TextEditingController controller, String labelText,
),
),
);
}*/

Widget buildTextFormField(TextEditingController controller, String labelText,
{bool isObscure = false}) {
return TextFormField(
controller: controller,
obscureText: isObscure,
validator: (String? val) {
if (val == null || val.isEmpty) {
return 'This field can\'t be empty';
}
return null;
},
cursorColor: AppColors.CommonCyan,
decoration: InputDecoration(
contentPadding: Space.all(),
border: const OutlineInputBorder(borderRadius: BorderRadius.zero),
hintText: "Enter your $labelText",
hintStyle: const TextStyle(
fontSize: 12,
color: AppColors.GreyText,
fontWeight: FontWeight.w400,
),
),
);
}
2 changes: 1 addition & 1 deletion lib/presentation/widgets/payment_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class _PaymentDetailsState extends State<PaymentDetails> {
},
child: Padding(
padding: Space.vf(1.5),
child: TransparentButton(
child: transparentButton(
context: context,
onTap: () {
if (context
Expand Down
6 changes: 3 additions & 3 deletions lib/presentation/widgets/proceedtocart_modalsheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ Future<void> showPoceedtoCartBottomSheet(BuildContext context) async {
Space.yf(.2),
const Text("printing and typesetting industry."),
Space.yf(2),
TransparentButton(
transparentButton(
context: context,
onTap: () {
context
.read<NavigationCubit>()
.updateTab(NavigationTab.cartTab);
Navigator.popAndPushNamed(context, AppRouter.mainscreen);
Navigator.popAndPushNamed(context, AppRouter.root);
},
buttonText: "Proceed to Cart"),
Space.yf(1.5),
Expand All @@ -52,7 +52,7 @@ Future<void> showPoceedtoCartBottomSheet(BuildContext context) async {
context
.read<NavigationCubit>()
.updateTab(NavigationTab.productsTap);
Navigator.popAndPushNamed(context, AppRouter.mainscreen);
Navigator.popAndPushNamed(context, AppRouter.root);
},
child: Text(
"Continue Shopping",
Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/widgets/successful_auth_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Future<void> showSuccessfulAuthDialog(BuildContext context, String text) async {
.read<DeliveryInfoFetchCubit>()
.fetchDeliveryInfo();
Navigator.of(context).pushNamedAndRemoveUntil(
AppRouter.mainscreen,
AppRouter.root,
ModalRoute.withName(''),
);
},
Expand Down
20 changes: 19 additions & 1 deletion lib/presentation/widgets/transparent_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import '../../configs/configs.dart';
import '../../core/constant/colors.dart';

Widget TransparentButton({
Widget transparentButton({
required BuildContext context,
required void Function() onTap,
required String buttonText,
Expand All @@ -27,3 +27,21 @@ Widget TransparentButton({
),
);
}

/*Widget transparentButton({
required BuildContext context,
required void Function() onTap,
required String buttonText,
}) {
return SizedBox(
width: double.infinity,
child: OutlinedButton(
onPressed: onTap,
style: OutlinedButton.styleFrom(shape: const RoundedRectangleBorder()),
child: Text(
buttonText,
style: AppText.h3b?.copyWith(color: AppColors.CommonCyan),
),
),
);
}*/
35 changes: 20 additions & 15 deletions lib/presentation/widgets/unlogged_profile_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';

import 'package:piiicks/configs/configs.dart';
import 'package:piiicks/presentation/widgets/transparent_button.dart';

import '../../core/constant/assets.dart';
import '../../core/constant/colors.dart';
import '../../core/router/app_router.dart';

Widget unloggedProfileContainer(BuildContext context){
Widget unloggedProfileContainer(BuildContext context) {
return Container(
padding: Space.all(1.3, .7),
width: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
image: const AssetImage(
AppAssets.Profile_bg_png),
image: const AssetImage(AppAssets.Profile_bg_png),
fit: BoxFit.fill,
colorFilter: ColorFilter.mode(
Colors.grey.shade700,
BlendMode.colorBurn),
colorFilter:
ColorFilter.mode(Colors.grey.shade700, BlendMode.colorBurn),
),
),
child: Column(
Expand All @@ -27,8 +26,8 @@ Widget unloggedProfileContainer(BuildContext context){
Space.y1!,
SvgPicture.asset(
AppAssets.Profile,
colorFilter: const ColorFilter.mode(
AppColors.CommonCyan, BlendMode.srcIn),
colorFilter:
const ColorFilter.mode(AppColors.CommonCyan, BlendMode.srcIn),
height: AppDimensions.normalize(19),
),
Space.y1!,
Expand All @@ -46,17 +45,23 @@ Widget unloggedProfileContainer(BuildContext context){
width: double.infinity,
child: ElevatedButton(
onPressed: () {
Navigator.of(context)
.pushNamed(AppRouter.login);
Navigator.of(context).pushNamed(AppRouter.login);
},
child: Text(
"Login",
style: AppText.h3b
?.copyWith(color: Colors.white),
style: AppText.h3b?.copyWith(color: Colors.white),
),
),
),
GestureDetector(
Space.yf(1.1),
transparentButton(
context: context,
onTap: () {
Navigator.of(context).pushNamed(AppRouter.signup);
},
buttonText: "Signup",
),
/* GestureDetector(
onTap: () {
Navigator.of(context)
.pushNamed(AppRouter.signup);
Expand All @@ -78,9 +83,9 @@ Widget unloggedProfileContainer(BuildContext context){
),
),
),
),
),*/
Space.yf(.6)
],
),
);
}
}

0 comments on commit c7a9d3c

Please sign in to comment.