This commit is contained in:
D Shrat 2022-05-21 17:50:26 +07:00
commit edde0a2478
12 changed files with 22 additions and 41 deletions

View file

@ -5,7 +5,6 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:nekoya_flutter/api/api.dart';
import 'package:nekoya_flutter/data/auth.dart';
import 'package:nekoya_flutter/data/cart.dart';
import 'package:nekoya_flutter/screens/payment.dart';
class CheckoutForm extends StatefulWidget {
const CheckoutForm({Key? key}) : super(key: key);
@ -257,11 +256,7 @@ class _CheckoutFormState extends State<CheckoutForm> {
if (isLoggedIn) {
submitForm(context).then((statusCode) {
if (statusCode == 201) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const Payment()));
Navigator.pushReplacementNamed(context, '/payment');
} else if (statusCode == 999) {
showAlertDialog(context);
}

View file

@ -71,13 +71,13 @@ class _MenuState extends State<Menu> {
}
});
} else if (index == 1) {
html.window.history.pushState(null, '', '/products');
html.window.history.pushState(null, '', '/#/products');
_selectedWidget = const Products();
} else if (index == 2) {
html.window.history.pushState(null, '', '');
_selectedWidget = const Home();
} else if (index == 3) {
html.window.history.pushState(null, '', '/cart');
html.window.history.pushState(null, '', '/#/cart');
_selectedWidget = const Cart();
} else if (index == 4) {
checkSessionExist().then((isLoggedIn) {

View file

@ -1,6 +1,6 @@
import 'package:lottie/lottie.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
class OtpBody extends StatefulWidget {
const OtpBody({Key? key}) : super(key: key);

View file

@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart';
import 'package:nekoya_flutter/data/cart.dart';
import 'package:nekoya_flutter/components/menu.dart';
class PaymentBody extends StatefulWidget {
const PaymentBody({Key? key}) : super(key: key);
@ -64,8 +63,8 @@ class _PaymentBodyState extends State<PaymentBody> {
child: ClipRRect(
borderRadius: BorderRadius.circular(18),
child: const ExpansionTile(
backgroundColor: const Color(0xff212226),
collapsedBackgroundColor: const Color(0xff212226),
backgroundColor: Color(0xff212226),
collapsedBackgroundColor: Color(0xff212226),
textColor: Colors.white,
collapsedTextColor: Colors.white,
title: Text(
@ -93,8 +92,8 @@ class _PaymentBodyState extends State<PaymentBody> {
child: ClipRRect(
borderRadius: BorderRadius.circular(18),
child: const ExpansionTile(
backgroundColor: const Color(0xff212226),
collapsedBackgroundColor: const Color(0xff212226),
backgroundColor: Color(0xff212226),
collapsedBackgroundColor: Color(0xff212226),
textColor: Colors.white,
collapsedTextColor: Colors.white,
title: Text(
@ -120,8 +119,8 @@ class _PaymentBodyState extends State<PaymentBody> {
child: ClipRRect(
borderRadius: BorderRadius.circular(18),
child: const ExpansionTile(
backgroundColor: const Color(0xff212226),
collapsedBackgroundColor: const Color(0xff212226),
backgroundColor: Color(0xff212226),
collapsedBackgroundColor: Color(0xff212226),
textColor: Colors.white,
collapsedTextColor: Colors.white,
title: Text(
@ -205,8 +204,7 @@ class _PaymentBodyState extends State<PaymentBody> {
borderRadius: BorderRadius.circular(18.0),
side: const BorderSide(color: Color(0xff8B0000))))),
onPressed: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => const Menu(initialScreen: 4)));
Navigator.pushReplacementNamed(context, '');
},
child: const Text(
'Transaction',

View file

@ -7,13 +7,11 @@ import 'package:nekoya_flutter/screens/login.dart';
import 'package:nekoya_flutter/screens/register.dart';
import 'package:nekoya_flutter/screens/payment.dart';
import 'package:nekoya_flutter/components/menu.dart';
import 'package:nekoya_flutter/utils/url_strategy.dart';
import 'package:nekoya_flutter/utils/navigation_auth.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]).then((_) {
usePathUrlStrategy();
runApp(const Nekoya());
});
}
@ -33,16 +31,16 @@ class _NekoyaState extends State<Nekoya> {
theme: ThemeData(
colorScheme:
ColorScheme.fromSwatch(accentColor: const Color(0xff8B0000))),
home: AnimatedSplashScreen(
splash: 'assets/images/logo_transparent.webp',
pageTransitionType: PageTransitionType.fade,
backgroundColor: const Color(0xff1b1c1e),
splashIconSize: 150,
nextScreen: const Menu(initialScreen: 2,),
),
debugShowCheckedModeBanner: false,
initialRoute: '',
routes: {
'' : (context) => const Menu(initialScreen: 2,),
'' : (context) => AnimatedSplashScreen(
splash: 'assets/images/logo_transparent.webp',
pageTransitionType: PageTransitionType.fade,
backgroundColor: const Color(0xff1b1c1e),
splashIconSize: 150,
nextScreen: const Menu(initialScreen: 2,),
),
'/login': (context) => const Login(),
'/register': (context) => const Register(),
'/products' : (context) => const Menu(initialScreen: 1,),

View file

@ -18,6 +18,7 @@ class _PaymentState extends State<Payment> {
title: const Text('Payment'),
centerTitle: true,
backgroundColor: const Color(0xff212226),
automaticallyImplyLeading: false,
),
body: const PaymentBody());
}

View file

@ -20,7 +20,7 @@ class NavigationAuth extends StatelessWidget {
if (data) {
return route;
} else {
html.window.history.pushState(null, '', '/login');
html.window.history.pushState(null, '', '/#/login');
return const Login();
}
} else {

View file

@ -1 +0,0 @@
export 'url_strategy_noop.dart' if (dart.library.html) 'url_strategy_web.dart';

View file

@ -1,3 +0,0 @@
void usePathUrlStrategy() {
// noop
}

View file

@ -1,5 +0,0 @@
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
void usePathUrlStrategy() {
setUrlStrategy(PathUrlStrategy());
}

View file

@ -194,7 +194,7 @@ packages:
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: "direct main"
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"

View file

@ -37,8 +37,6 @@ dependencies:
flutter_form_builder: ^7.1.1
flutter_launcher_icons_maker: ^0.10.2
flutter_svg: ^1.0.3
flutter_web_plugins:
sdk: flutter
intl: ^0.17.0
lottie: ^1.3.0
page_transition: ^2.0.5