This commit is contained in:
Kelvin Samuel 2022-05-15 14:08:08 +07:00
commit 07099cf55f
23 changed files with 119 additions and 115 deletions

View file

@ -1,5 +0,0 @@
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
<g opacity="0.3">
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.9025 9.68574C19.9025 10.985 20.2441 11.7509 20.9959 12.6334C21.5656 13.2835 21.7476 14.1181 21.7476 15.0236C21.7476 15.928 21.452 16.7865 20.8599 17.4836C20.0846 18.3192 18.9913 18.8527 17.8754 18.9454C16.2584 19.084 14.6404 19.2007 13.0009 19.2007C11.3604 19.2007 9.74343 19.1309 8.12644 18.9454C7.00958 18.8527 5.91625 18.3192 5.14202 17.4836C4.54984 16.7865 4.25323 15.928 4.25323 15.0236C4.25323 14.1181 4.43631 13.2835 5.00497 12.6334C5.78022 11.7509 6.09932 10.985 6.09932 9.68574V9.245C6.09932 7.50497 6.53093 6.36717 7.41971 5.25334C8.74112 3.62896 10.8593 2.65475 12.9549 2.65475H13.047C15.1876 2.65475 17.3743 3.67585 18.6732 5.37004C19.5159 6.46095 19.9025 7.55081 19.9025 9.245V9.68574ZM9.98949 21.339C9.98949 20.8181 10.4651 20.5795 10.9049 20.4774C11.4193 20.368 14.5541 20.368 15.0685 20.4774C15.5083 20.5795 15.9839 20.8181 15.9839 21.339C15.9583 21.835 15.6689 22.2747 15.269 22.5539C14.7505 22.9603 14.1419 23.2177 13.5058 23.3104C13.1539 23.3562 12.8082 23.3573 12.4687 23.3104C11.8315 23.2177 11.2229 22.9603 10.7054 22.5529C10.3045 22.2747 10.0151 21.835 9.98949 21.339Z" fill="#1C1A19"/>
</g>
</svg>

Before

(image error) Size: 1.3 KiB

View file

@ -1,5 +0,0 @@
<svg width="29" height="18" viewBox="0 0 29 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<line x1="1.5" y1="1" x2="27.0442" y2="1" stroke="black" stroke-width="2" stroke-linecap="round"/>
<line x1="1.5" y1="8.55573" x2="19.7285" y2="8.55573" stroke="black" stroke-width="2" stroke-linecap="round"/>
<line x1="1.5" y1="16.3913" x2="13.2721" y2="16.3913" stroke="black" stroke-width="2" stroke-linecap="round"/>
</svg>

Before

(image error) Size: 424 B

View file

@ -6,7 +6,7 @@ class Category {
Category({required this.icon, required this.title});
}
List<Category> demo_categories = [
List<Category> demoCategories = [
Category(
icon: "assets/icons/dress.svg",
title: "Dress",

View file

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:nekoya_flutter/components/Category.dart';
import 'package:nekoya_flutter/components/_category.dart';
import '../utils/utils.dart';
@ -15,10 +15,10 @@ class Categories extends StatelessWidget {
height: 84,
child: ListView.separated(
scrollDirection: Axis.horizontal,
itemCount: demo_categories.length,
itemCount: demoCategories.length,
itemBuilder: (context, index) => CategoryCard(
icon: demo_categories[index].icon,
title: demo_categories[index].title,
icon: demoCategories[index].icon,
title: demoCategories[index].title,
press: () {},
),
separatorBuilder: (context, index) =>

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/login.dart';
import 'package:nekoya_flutter/screens/payment.dart';
class CheckoutForm extends StatefulWidget {
@ -268,10 +267,7 @@ class _CheckoutFormState extends State<CheckoutForm> {
}
});
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Login()));
Navigator.pushNamed(context, '/login');
}
});
},

View file

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import '../utils/utils.dart';
import 'package:nekoya_flutter/screens/productcoba.dart';
import 'package:nekoya_flutter/screens/products.dart';
import 'package:nekoya_flutter/components/color_dot.dart';
@ -62,7 +61,7 @@ class DetailsScreen extends StatelessWidget {
),
const SizedBox(width: defaultPadding),
Text(
"\$" + product.price.toString(),
"\$${product.price}",
style: Theme.of(context).textTheme.headline6,
),
],

View file

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
import 'package:nekoya_flutter/screens/login.dart';
import 'package:nekoya_flutter/screens/otp.dart';
class ForgotPassBody extends StatefulWidget {
@ -80,8 +79,7 @@ class _ForgotPassBodyState extends State<ForgotPassBody> {
borderRadius: BorderRadius.circular(18.0),
side: const BorderSide(color: Colors.red)))),
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => const Login()));
Navigator.pushNamed(context, '/login');
},
child: const Text(
'Back to Login',

View file

@ -5,7 +5,6 @@ import 'package:nekoya_flutter/api/api.dart';
import 'package:nekoya_flutter/components/login_error.dart';
import 'package:nekoya_flutter/components/menu.dart';
import 'package:nekoya_flutter/data/auth.dart';
import 'package:nekoya_flutter/screens/register.dart';
import 'package:nekoya_flutter/utils/utils.dart';
class LoginForm extends StatefulWidget {
@ -168,8 +167,7 @@ class LoginFormState extends State<LoginForm> {
return GestureDetector(
onTap: () {
Navigator.pop(context);
Navigator.push(
context, MaterialPageRoute(builder: (context) => const Register()));
Navigator.pushNamed(context, '/register');
},
child: RichText(
text: const TextSpan(

View file

@ -1,14 +1,13 @@
import 'package:flutter/material.dart';
import 'dart:math' as math;
import 'package:universal_html/html.dart' as html;
import 'package:flutter/material.dart';
import 'package:nekoya_flutter/data/auth.dart';
import 'package:nekoya_flutter/screens/login.dart';
import 'package:nekoya_flutter/screens/products.dart';
import 'package:nekoya_flutter/screens/cart.dart';
import 'package:nekoya_flutter/screens/register.dart';
import 'package:nekoya_flutter/screens/sessions.dart';
import 'package:nekoya_flutter/screens/transactions.dart';
import 'package:nekoya_flutter/screens/home_screen.dart';
import 'package:nekoya_flutter/screens/home.dart';
class Menu extends StatefulWidget {
const Menu({Key? key, required this.initialScreen}) : super(key: key);
@ -26,11 +25,11 @@ class _MenuState extends State<Menu> {
@override
void initState() {
if (widget.initialScreen == 0) {
_selectedWidget = const Login();
_selectedWidget = const Sessions();
} else if (widget.initialScreen == 1) {
_selectedWidget = const Register();
} else if (widget.initialScreen == 2) {
_selectedWidget = const Products();
} else if (widget.initialScreen == 2) {
_selectedWidget = const Home();
} else if (widget.initialScreen == 3) {
_selectedWidget = const Cart();
} else if (widget.initialScreen == 4) {
@ -68,15 +67,16 @@ class _MenuState extends State<Menu> {
_selectedWidget = const Sessions();
} else {
_selectedIndex = oldSelectedIndex;
Navigator.push(context,
MaterialPageRoute(builder: (context) => const Login()));
Navigator.pushNamed(context, '/login');
}
});
} else if (index == 1) {
_selectedWidget = const HomeScreen();
} else if (index == 2) {
html.window.history.pushState(null, '', '/products');
_selectedWidget = const Products();
} else if (index == 2) {
_selectedWidget = const Home();
} else if (index == 3) {
html.window.history.pushState(null, '', '/cart');
_selectedWidget = const Cart();
} else if (index == 4) {
checkSessionExist().then((isLoggedIn) {
@ -84,8 +84,7 @@ class _MenuState extends State<Menu> {
_selectedWidget = const Transactions();
} else {
_selectedIndex = oldSelectedIndex;
Navigator.push(context,
MaterialPageRoute(builder: (context) => const Login()));
Navigator.pushNamed(context, '/login');
}
});
}

View file

@ -28,20 +28,20 @@ class NewArrivalProducts extends StatelessWidget {
scrollDirection: Axis.horizontal,
child: Row(
children: List.generate(
demo_product.length,
demoProduct.length,
(index) => Padding(
padding: const EdgeInsets.only(right: defaultPadding),
child: ProductCard(
title: demo_product[index].title,
image: demo_product[index].image,
price: demo_product[index].price,
bgColor: demo_product[index].bgColor,
title: demoProduct[index].title,
image: demoProduct[index].image,
price: demoProduct[index].price,
bgColor: demoProduct[index].bgColor,
press: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
DetailsScreen(product: demo_product[index]),
DetailsScreen(product: demoProduct[index]),
));
},
),

View file

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lottie/lottie.dart';
import 'package:nekoya_flutter/screens/login.dart';
class OtpBody extends StatefulWidget {
const OtpBody({Key? key}) : super(key: key);
@ -20,8 +19,8 @@ class _OtpBodyState extends State<OtpBody> {
child: Lottie.asset('assets/lottieanims/otp.json'),
),
Container(
padding: EdgeInsets.only(top: 15),
child: Text(
padding: const EdgeInsets.only(top: 15),
child: const Text(
'A String of OTP Code Has Been Sent to 08080808080808',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 15, color: Colors.white),
@ -29,7 +28,7 @@ class _OtpBodyState extends State<OtpBody> {
),
Form(
child: Container(
padding: EdgeInsets.only(top: 15),
padding: const EdgeInsets.only(top: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
@ -45,18 +44,18 @@ class _OtpBodyState extends State<OtpBody> {
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
} else if (value.length == 0) {
} else if (value.isEmpty) {
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
@ -76,18 +75,18 @@ class _OtpBodyState extends State<OtpBody> {
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
} else if (value.length == 0) {
} else if (value.isEmpty) {
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
@ -107,18 +106,18 @@ class _OtpBodyState extends State<OtpBody> {
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
} else if (value.length == 0) {
} else if (value.isEmpty) {
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
@ -138,18 +137,18 @@ class _OtpBodyState extends State<OtpBody> {
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
} else if (value.length == 0) {
} else if (value.isEmpty) {
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
@ -169,18 +168,18 @@ class _OtpBodyState extends State<OtpBody> {
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
} else if (value.length == 0) {
} else if (value.isEmpty) {
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
@ -200,18 +199,18 @@ class _OtpBodyState extends State<OtpBody> {
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
} else if (value.length == 0) {
} else if (value.isEmpty) {
FocusScope.of(context).previousFocus();
}
},
onSaved: (pin1) {},
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: "0",
focusColor: Colors.white,
hintStyle: TextStyle(color: Colors.white),
),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
keyboardType: TextInputType.number,
inputFormatters: [
LengthLimitingTextInputFormatter(1),
@ -224,12 +223,12 @@ class _OtpBodyState extends State<OtpBody> {
),
)),
Container(
padding: EdgeInsets.only(top: 15, bottom: 15),
padding: const EdgeInsets.only(top: 15, bottom: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
const Text(
"didn't get the code? \t",
style: TextStyle(color: Colors.white),
),
@ -251,8 +250,7 @@ class _OtpBodyState extends State<OtpBody> {
borderRadius: BorderRadius.circular(18.0),
side: const BorderSide(color: Colors.red)))),
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => const Login()));
Navigator.pushNamed(context, '/login');
},
child: const Text(
'Verify',

View file

@ -27,14 +27,14 @@ class PopularProducts extends StatelessWidget {
scrollDirection: Axis.horizontal,
child: Row(
children: List.generate(
demo_product.length,
demoProduct.length,
(index) => Padding(
padding: const EdgeInsets.only(right: defaultPadding),
child: ProductCard(
title: demo_product[index].title,
image: demo_product[index].image,
price: demo_product[index].price,
bgColor: demo_product[index].bgColor,
title: demoProduct[index].title,
image: demoProduct[index].image,
price: demoProduct[index].price,
bgColor: demoProduct[index].bgColor,
press: () {},
),
),

View file

@ -52,7 +52,7 @@ class ProductCard extends StatelessWidget {
),
const SizedBox(width: defaultPadding / 4),
Text(
"\$" + price.toString(),
"\$$price",
style: Theme.of(context).textTheme.subtitle2,
),
],

View file

@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart';
import 'package:nekoya_flutter/data/cart.dart';
import 'package:nekoya_flutter/screens/productcoba.dart';
import 'package:nekoya_flutter/utils/utils.dart';
Widget makeDismissible({required context, required Widget child}) =>

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/components/register_error.dart';
import 'package:nekoya_flutter/components/register_verify.dart';
import 'package:nekoya_flutter/screens/login.dart';
class RegisterForm extends StatefulWidget {
const RegisterForm({Key? key}) : super(key: key);
@ -156,10 +155,7 @@ class RegisterFormState extends State<RegisterForm> {
),
onPressed: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Login()));
Navigator.pushNamed(context, '/login');
},
),
],

View file

@ -3,12 +3,15 @@ import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart';
import 'package:animated_splash_screen/animated_splash_screen.dart';
import 'package:nekoya_flutter/screens/login.dart';
import 'package:nekoya_flutter/screens/register.dart';
import 'package:nekoya_flutter/components/menu.dart';
import 'package:nekoya_flutter/utils/url_strategy.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]).then((_) {
usePathUrlStrategy();
runApp(const Nekoya());
});
}
@ -36,6 +39,14 @@ class _NekoyaState extends State<Nekoya> {
nextScreen: const Menu(initialScreen: 2,),
),
debugShowCheckedModeBanner: false,
initialRoute: '',
routes: {
'' : (context) => const Menu(initialScreen: 2,),
'/login': (context) => const Login(),
'/register': (context) => const Register(),
'/products' : (context) => const Menu(initialScreen: 1,),
'/cart' : (context) => const Menu(initialScreen: 3,),
},
);
}
}

View file

@ -7,36 +7,17 @@ import 'package:nekoya_flutter/components/new_arrival_products.dart';
import 'package:nekoya_flutter/components/popular_products.dart';
import 'package:nekoya_flutter/components/search_form.dart';
class HomeScreen extends StatelessWidget {
const HomeScreen({Key? key}) : super(key: key);
class Home extends StatelessWidget {
const Home({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xff1b1c1e),
appBar: AppBar(
title: const Text('Nekoya'),
centerTitle: true,
backgroundColor: const Color(0xff212226),
leading: IconButton(
onPressed: () {},
icon: SvgPicture.asset("assets/icons/menu.svg"),
),
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(width: defaultPadding / 2),
Text(
"Nekoya",
style: TextStyle(fontSize: 20.0, color: Colors.white),
),
],
),
actions: [
IconButton(
icon: SvgPicture.asset("assets/icons/Notification.svg"),
color: Colors.white,
onPressed: () {},
),
],
),
body: SingleChildScrollView(
physics: const BouncingScrollPhysics(

View file

@ -13,7 +13,7 @@ class Product {
});
}
List<Product> demo_product = [
List<Product> demoProduct = [
Product(
image: "assets/Product_2.webp",
title: "Long Sleeve Shirts",

View file

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

View file

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

View file

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

View file

@ -92,6 +92,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.1"
cupertino_icons:
dependency: "direct main"
description:
@ -180,10 +187,17 @@ packages:
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.0"
http:
dependency: transitive
description:
@ -511,6 +525,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
universal_html:
dependency: "direct main"
description:
name: universal_html
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
universal_io:
dependency: transitive
description:
name: universal_io
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
uuid:
dependency: transitive
description:

View file

@ -28,7 +28,6 @@ environment:
# versions available, run `flutter pub outdated`.
dependencies:
animated_splash_screen: ^1.2.0
page_transition: ^2.0.5
cached_network_image: ^3.2.0
cupertino_icons: ^1.0.2
dio: ^4.0.6
@ -36,10 +35,14 @@ dependencies:
sdk: flutter
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
shared_preferences: ^2.0.13
flutter_svg: ^1.0.3
universal_html: ^2.0.8
dev_dependencies:
flutter_lints: ^2.0.1
@ -87,6 +90,5 @@ flutter:
weight: 700
- asset: assets/fonts/Gordita_Light.otf
weight: 300
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages