Sync all source code with the latest flutter SDK and dependencies

This commit is contained in:
Moe Poi ~ 2023-09-22 14:29:07 +07:00
parent 45a3c583d9
commit 25df88bb80
Signed by: moepoi
GPG key ID: 334B501E883409AF
43 changed files with 695 additions and 631 deletions

View file

@ -8,7 +8,7 @@ android:release:
before_script: before_script:
- flutter create . - flutter create .
- flutter pub get - flutter pub get
- flutter pub run flutter_launcher_icons_maker:main - flutter pub run flutter_launcher_icons
- flutter clean - flutter clean
script: script:
- flutter doctor --android-licenses - flutter doctor --android-licenses

View file

@ -1,11 +1,11 @@
# This file tracks properties of this Flutter project. # This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc. # Used by Flutter tool to assess capabilities and perform upgrades etc.
# #
# This file should be version controlled. # This file should be version controlled and should not be manually edited.
version: version:
revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 revision: "367f9ea16bfae1ca451b9cc27c1366870b187ae2"
channel: stable channel: "stable"
project_type: app project_type: app
@ -13,26 +13,26 @@ project_type: app
migration: migration:
platforms: platforms:
- platform: root - platform: root
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
- platform: android - platform: android
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
- platform: ios - platform: ios
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
- platform: linux - platform: linux
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
- platform: macos - platform: macos
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
- platform: web - platform: web
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
- platform: windows - platform: windows
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 create_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268 base_revision: 367f9ea16bfae1ca451b9cc27c1366870b187ae2
# User provided section # User provided section

View file

@ -1,6 +1,6 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:nekoya_flutter/api/config.dart'; import 'package:nekoya_app/api/config.dart';
Future<dynamic> getProducts() async { Future<dynamic> getProducts() async {
var req = await Dio().get('$host/getproducts'); var req = await Dio().get('$host/getproducts');

View file

@ -15,14 +15,14 @@ class _AboutUsBodyState extends State<AboutUsBody> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_controller = _controller = VideoPlayerController.networkUrl(
VideoPlayerController.network('https://nekoya.moe.team/img/AboutUs.mp4') Uri.parse('https://nekoya.moe.team/img/AboutUs.mp4'))
..initialize().then((_) { ..initialize().then((_) {
setState(() { setState(() {
_controller.play(); _controller.play();
_controller.setLooping(true); _controller.setLooping(true);
}); });
}); });
} }
@override @override

View file

@ -51,7 +51,7 @@ class Bannerimage extends StatelessWidget {
Navigator.pushReplacementNamed(context, '/products'); Navigator.pushReplacementNamed(context, '/products');
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: Colors.red, backgroundColor: Colors.red,
textStyle: const TextStyle( textStyle: const TextStyle(
fontSize: 14, fontWeight: FontWeight.bold)), fontSize: 14, fontWeight: FontWeight.bold)),
child: const Text('SHOP NOW'), child: const Text('SHOP NOW'),

View file

@ -2,9 +2,9 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/data/auth.dart'; import 'package:nekoya_app/data/auth.dart';
import 'package:nekoya_flutter/data/cart.dart'; import 'package:nekoya_app/data/cart.dart';
class CheckoutForm extends StatefulWidget { class CheckoutForm extends StatefulWidget {
const CheckoutForm({Key? key}) : super(key: key); const CheckoutForm({Key? key}) : super(key: key);
@ -102,8 +102,8 @@ class _CheckoutFormState extends State<CheckoutForm> {
const SizedBox( const SizedBox(
height: 20, height: 20,
), ),
Row( const Row(
children: const [ children: [
Text( Text(
"Contact Information", "Contact Information",
style: TextStyle( style: TextStyle(
@ -131,8 +131,8 @@ class _CheckoutFormState extends State<CheckoutForm> {
const SizedBox( const SizedBox(
height: 20, height: 20,
), ),
Row( const Row(
children: const [ children: [
Text( Text(
"Address", "Address",
style: TextStyle( style: TextStyle(
@ -180,8 +180,8 @@ class _CheckoutFormState extends State<CheckoutForm> {
const SizedBox( const SizedBox(
height: 20, height: 20,
), ),
Row( const Row(
children: const [ children: [
Text( Text(
"Shipping Methods", "Shipping Methods",
style: TextStyle( style: TextStyle(

View file

@ -1,9 +1,9 @@
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/data/cart.dart'; import 'package:nekoya_app/data/cart.dart';
import 'package:nekoya_flutter/components/cart_box.dart'; import 'package:nekoya_app/components/cart_box.dart';
class CheckoutItems extends StatefulWidget { class CheckoutItems extends StatefulWidget {
const CheckoutItems({Key? key}) : super(key: key); const CheckoutItems({Key? key}) : super(key: key);
@ -13,7 +13,6 @@ class CheckoutItems extends StatefulWidget {
} }
class _CheckoutItemsState extends State<CheckoutItems> { class _CheckoutItemsState extends State<CheckoutItems> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Future<dynamic> getTotal() async { Future<dynamic> getTotal() async {
@ -69,7 +68,8 @@ class _CheckoutItemsState extends State<CheckoutItems> {
if (productData != null) { if (productData != null) {
return CartBox( return CartBox(
controller: false, controller: false,
imageUrl: "https://nekoya.moe.team/img/${productData[0]['IMAGE']}", imageUrl:
"https://nekoya.moe.team/img/${productData[0]['IMAGE']}",
title: productData[0]['TITLE'], title: productData[0]['TITLE'],
quantity: data[index]["quantity"], quantity: data[index]["quantity"],
plus: () {}, plus: () {},
@ -123,9 +123,9 @@ class _CheckoutItemsState extends State<CheckoutItems> {
); );
} }
return Row( return const Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: const [ children: [
Text( Text(
"Total : -", "Total : -",
style: TextStyle( style: TextStyle(

View file

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/utils/utils.dart'; import 'package:nekoya_app/utils/utils.dart';
class ColorDot extends StatelessWidget { class ColorDot extends StatelessWidget {
const ColorDot({ const ColorDot({

View file

@ -1,7 +1,7 @@
import 'package:lottie/lottie.dart'; import 'package:lottie/lottie.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
class ForgotPassBody extends StatefulWidget { class ForgotPassBody extends StatefulWidget {
const ForgotPassBody({Key? key}) : super(key: key); const ForgotPassBody({Key? key}) : super(key: key);
@ -45,8 +45,8 @@ class _ForgotPassBodyState extends State<ForgotPassBody> {
), ),
Container( Container(
padding: const EdgeInsets.only(top: 25, bottom: 20), padding: const EdgeInsets.only(top: 25, bottom: 20),
child: Row( child: const Row(
children: const [ children: [
Icon( Icon(
Icons.mail_sharp, Icons.mail_sharp,
color: Colors.white, color: Colors.white,
@ -75,7 +75,9 @@ class _ForgotPassBodyState extends State<ForgotPassBody> {
), ),
), ),
), ),
const SizedBox(height: 10,), const SizedBox(
height: 10,
),
ElevatedButton( ElevatedButton(
style: ButtonStyle( style: ButtonStyle(
padding: MaterialStateProperty.all(const EdgeInsets.all(15.0)), padding: MaterialStateProperty.all(const EdgeInsets.all(15.0)),
@ -94,32 +96,37 @@ class _ForgotPassBodyState extends State<ForgotPassBody> {
forgotForm(context).then((res) { forgotForm(context).then((res) {
if (res['statusCode'] == 200) { if (res['statusCode'] == 200) {
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: const Text('Forgot Password', style: TextStyle(color: Colors.white),), title: const Text(
backgroundColor: const Color(0xff212226), 'Forgot Password',
content: SingleChildScrollView( style: TextStyle(color: Colors.white),
child: ListBody(
children: const <Widget>[
Text('Please check your email to reset your password', style: TextStyle(
color: Colors.white
)),
],
), ),
), backgroundColor: const Color(0xff212226),
actions: <Widget>[ content: const SingleChildScrollView(
TextButton( child: ListBody(
child: const Text('Close', style: TextStyle(color: Colors.white),), children: <Widget>[
onPressed: () { Text(
Navigator.of(context).pop(); 'Please check your email to reset your password',
}, style: TextStyle(color: Colors.white)),
],
),
), ),
], actions: <Widget>[
); TextButton(
} child: const Text(
); 'Close',
style: TextStyle(color: Colors.white),
),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
});
} else if (res['statusCode'] == 205) { } else if (res['statusCode'] == 205) {
showEmailWarn(context); showEmailWarn(context);
} else { } else {

View file

@ -1,11 +1,11 @@
import 'package:lottie/lottie.dart'; import 'package:lottie/lottie.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/components/menu.dart'; import 'package:nekoya_app/components/menu.dart';
import 'package:nekoya_flutter/data/auth.dart'; import 'package:nekoya_app/data/auth.dart';
import 'package:nekoya_flutter/screens/otp.dart'; import 'package:nekoya_app/screens/otp.dart';
import 'package:nekoya_flutter/utils/utils.dart'; import 'package:nekoya_app/utils/utils.dart';
class LoginForm extends StatefulWidget { class LoginForm extends StatefulWidget {
const LoginForm({Key? key}) : super(key: key); const LoginForm({Key? key}) : super(key: key);

View file

@ -2,12 +2,12 @@ import 'dart:math' as math;
import 'package:universal_html/html.dart' as html; import 'package:universal_html/html.dart' as html;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/data/auth.dart'; import 'package:nekoya_app/data/auth.dart';
import 'package:nekoya_flutter/screens/products.dart'; import 'package:nekoya_app/screens/products.dart';
import 'package:nekoya_flutter/screens/cart.dart'; import 'package:nekoya_app/screens/cart.dart';
import 'package:nekoya_flutter/screens/sessions.dart'; import 'package:nekoya_app/screens/sessions.dart';
import 'package:nekoya_flutter/screens/transactions.dart'; import 'package:nekoya_app/screens/transactions.dart';
import 'package:nekoya_flutter/screens/home.dart'; import 'package:nekoya_app/screens/home.dart';
class Menu extends StatefulWidget { class Menu extends StatefulWidget {
const Menu({Key? key, required this.initialScreen}) : super(key: key); const Menu({Key? key, required this.initialScreen}) : super(key: key);

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/components/product_detail.dart'; import 'package:nekoya_app/components/product_detail.dart';
import 'package:nekoya_flutter/components/product_card.dart'; import 'package:nekoya_app/components/product_card.dart';
import 'package:nekoya_flutter/components/section_title.dart'; import 'package:nekoya_app/components/section_title.dart';
import 'package:nekoya_flutter/utils/utils.dart'; import 'package:nekoya_app/utils/utils.dart';
class NewArrivalProducts extends StatelessWidget { class NewArrivalProducts extends StatelessWidget {
const NewArrivalProducts({ const NewArrivalProducts({
@ -23,61 +23,63 @@ class NewArrivalProducts extends StatelessWidget {
), ),
), ),
FutureBuilder<dynamic>( FutureBuilder<dynamic>(
future: getProducts(), future: getProducts(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
var sourceData = snapshot.data; var sourceData = snapshot.data;
sourceData.shuffle(); sourceData.shuffle();
var data = sourceData.take(6).toList(); var data = sourceData.take(6).toList();
return SingleChildScrollView( return SingleChildScrollView(
physics: const BouncingScrollPhysics( physics: const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics()), parent: AlwaysScrollableScrollPhysics()),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Row( child: Row(
children: List.generate( children: List.generate(
data.length, data.length,
(index) => Padding( (index) => Padding(
padding: const EdgeInsets.only(right: defaultPadding), padding: const EdgeInsets.only(right: defaultPadding),
child: ProductCard( child: ProductCard(
title: data[index]['TITLE'], title: data[index]['TITLE'],
imageUrl: "https://nekoya.moe.team/img/${data[index]['IMAGE']}", imageUrl:
bgColor: const Color(0xFFFEFBF9), "https://nekoya.moe.team/img/${data[index]['IMAGE']}",
press: () { bgColor: const Color(0xFFFEFBF9),
showModalBottomSheet( press: () {
isScrollControlled: true, showModalBottomSheet(
backgroundColor: Colors.transparent, isScrollControlled: true,
context: context, backgroundColor: Colors.transparent,
builder: (context) => productDetail(context, data[index]['ID']), context: context,
); builder: (context) =>
}, productDetail(context, data[index]['ID']),
);
},
),
), ),
), ),
), ),
), );
); } else {
} else { return SingleChildScrollView(
return SingleChildScrollView( physics: const BouncingScrollPhysics(
physics: const BouncingScrollPhysics( parent: AlwaysScrollableScrollPhysics()),
parent: AlwaysScrollableScrollPhysics()), scrollDirection: Axis.horizontal,
scrollDirection: Axis.horizontal, child: Row(
child: Row( children: List.generate(
children: List.generate( 6,
6, (index) => Padding(
(index) => Padding( padding: const EdgeInsets.only(right: defaultPadding),
padding: const EdgeInsets.only(right: defaultPadding), child: ProductCard(
child: ProductCard( title: 'Loading...',
title: 'Loading...', imageUrl:
imageUrl: "https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp", "https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp",
bgColor: const Color(0xFFFEFBF9), bgColor: const Color(0xFFFEFBF9),
press: () {}, press: () {},
),
), ),
), ),
), ),
), );
); }
} })
}
)
], ],
); );
} }

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/utils/utils.dart'; import 'package:nekoya_app/utils/utils.dart';
const OutlineInputBorder outlineInputBorder = OutlineInputBorder( const OutlineInputBorder outlineInputBorder = OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12)), borderRadius: BorderRadius.all(Radius.circular(12)),
@ -62,7 +62,8 @@ class _NewsletterState extends State<Newsletter> {
padding: const EdgeInsets.all(14), padding: const EdgeInsets.all(14),
child: SvgPicture.asset( child: SvgPicture.asset(
"assets/icons/email.svg", "assets/icons/email.svg",
color: Colors.white, colorFilter: const ColorFilter.mode(
Colors.white, BlendMode.srcIn),
width: 21.5, width: 21.5,
height: 21.5, height: 21.5,
), ),
@ -76,7 +77,7 @@ class _NewsletterState extends State<Newsletter> {
height: 48, height: 48,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: const Color(0xff8B0000), backgroundColor: const Color(0xff8B0000),
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.all(Radius.circular(12)), BorderRadius.all(Radius.circular(12)),
@ -87,34 +88,46 @@ class _NewsletterState extends State<Newsletter> {
subscribe(emailQuery).then((status) { subscribe(emailQuery).then((status) {
if (status == 200) { if (status == 200) {
emailController.clear(); emailController.clear();
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context)
.requestFocus(FocusNode());
return showDialog( return showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: const Text('Thank You', style: TextStyle(color: Colors.white),), title: const Text(
backgroundColor: const Color(0xff212226), 'Thank You',
content: SingleChildScrollView( style: TextStyle(
child: ListBody( color: Colors.white),
children: const <Widget>[
Text('You have successfully subscribed to the newsletter.', style: TextStyle(
color: Colors.white
)),
],
), ),
), backgroundColor:
actions: <Widget>[ const Color(0xff212226),
TextButton( content:
child: const Text('Close', style: TextStyle(color: Colors.white),), const SingleChildScrollView(
onPressed: () { child: ListBody(
Navigator.of(context).pop(); children: <Widget>[
}, Text(
'You have successfully subscribed to the newsletter.',
style: TextStyle(
color:
Colors.white)),
],
),
), ),
], actions: <Widget>[
); TextButton(
} child: const Text(
); 'Close',
style: TextStyle(
color: Colors.white),
),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
});
} }
}); });
} }

View file

@ -2,9 +2,9 @@ import 'package:lottie/lottie.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/components/menu.dart'; import 'package:nekoya_app/components/menu.dart';
import 'package:nekoya_flutter/data/auth.dart'; import 'package:nekoya_app/data/auth.dart';
class OtpBody extends StatefulWidget { class OtpBody extends StatefulWidget {
const OtpBody({Key? key, required this.otpToken}) : super(key: key); const OtpBody({Key? key, required this.otpToken}) : super(key: key);
@ -24,12 +24,18 @@ class _OtpBodyState extends State<OtpBody> {
TextEditingController otpCode6 = TextEditingController(); TextEditingController otpCode6 = TextEditingController();
Future submitForm(BuildContext context) async { Future submitForm(BuildContext context) async {
if (otpCode1.text.isEmpty || otpCode2.text.isEmpty || otpCode3.text.isEmpty || otpCode4.text.isEmpty || otpCode5.text.isEmpty || otpCode6.text.isEmpty) { if (otpCode1.text.isEmpty ||
otpCode2.text.isEmpty ||
otpCode3.text.isEmpty ||
otpCode4.text.isEmpty ||
otpCode5.text.isEmpty ||
otpCode6.text.isEmpty) {
return 999; return 999;
} else { } else {
Map<String, dynamic> data = { Map<String, dynamic> data = {
"token": widget.otpToken, "token": widget.otpToken,
"code": "${otpCode1.text}${otpCode2.text}${otpCode3.text}${otpCode4.text}${otpCode5.text}${otpCode6.text}" "code":
"${otpCode1.text}${otpCode2.text}${otpCode3.text}${otpCode4.text}${otpCode5.text}${otpCode6.text}"
}; };
var response = await otpPost(data); var response = await otpPost(data);
@ -255,7 +261,9 @@ class _OtpBodyState extends State<OtpBody> {
], ],
), ),
)), )),
const SizedBox(height: 30,), const SizedBox(
height: 30,
),
ElevatedButton( ElevatedButton(
style: ButtonStyle( style: ButtonStyle(
padding: MaterialStateProperty.all(const EdgeInsets.all(15.0)), padding: MaterialStateProperty.all(const EdgeInsets.all(15.0)),
@ -272,9 +280,10 @@ class _OtpBodyState extends State<OtpBody> {
if (res['statusCode'] == 200) { if (res['statusCode'] == 200) {
addSession(res['data']['id'], res['data']['session_token']); addSession(res['data']['id'], res['data']['session_token']);
Navigator.pop(context); Navigator.pop(context);
Navigator.pushReplacement(context, MaterialPageRoute( Navigator.pushReplacement(
builder: (context) => const Menu(initialScreen: 2) context,
)); MaterialPageRoute(
builder: (context) => const Menu(initialScreen: 2)));
Navigator.pop(context); Navigator.pop(context);
} }
}); });

View file

@ -1,8 +1,8 @@
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/data/cart.dart'; import 'package:nekoya_app/data/cart.dart';
class PaymentBody extends StatefulWidget { class PaymentBody extends StatefulWidget {
const PaymentBody({Key? key}) : super(key: key); const PaymentBody({Key? key}) : super(key: key);
@ -181,9 +181,9 @@ class _PaymentBodyState extends State<PaymentBody> {
); );
} }
return Row( return const Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: const [ children: [
Text( Text(
"Count total price on process!", "Count total price on process!",
style: TextStyle( style: TextStyle(

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/components/product_card.dart'; import 'package:nekoya_app/components/product_card.dart';
import 'package:nekoya_flutter/components/product_detail.dart'; import 'package:nekoya_app/components/product_detail.dart';
import 'package:nekoya_flutter/components/section_title.dart'; import 'package:nekoya_app/components/section_title.dart';
import 'package:nekoya_flutter/utils/utils.dart'; import 'package:nekoya_app/utils/utils.dart';
class PopularProducts extends StatelessWidget { class PopularProducts extends StatelessWidget {
const PopularProducts({ const PopularProducts({

View file

@ -1,7 +1,7 @@
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/utils/utils.dart'; import 'package:nekoya_app/utils/utils.dart';
class ProductCard extends StatelessWidget { class ProductCard extends StatelessWidget {
const ProductCard({ const ProductCard({
@ -32,17 +32,16 @@ class ProductCard extends StatelessWidget {
width: double.infinity, width: double.infinity,
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: Color(0xff212226), color: Color(0xff212226),
borderRadius: BorderRadius.all( borderRadius:
Radius.circular(defaultBorderRadius)), BorderRadius.all(Radius.circular(defaultBorderRadius)),
), ),
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: imageUrl, imageUrl: imageUrl,
placeholder: (context, url) => placeholder: (context, url) => const Center(
const Center( child: CircularProgressIndicator(
child: CircularProgressIndicator( color: Color(0xff8B0000),
color: Color(0xff8B0000), ),
), ),
),
errorWidget: (context, url, error) => errorWidget: (context, url, error) =>
Image.asset('assets/images/image_error.webp'), Image.asset('assets/images/image_error.webp'),
fadeOutDuration: const Duration(milliseconds: 5), fadeOutDuration: const Duration(milliseconds: 5),

View file

@ -2,9 +2,9 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/data/cart.dart'; import 'package:nekoya_app/data/cart.dart';
import 'package:nekoya_flutter/utils/utils.dart'; import 'package:nekoya_app/utils/utils.dart';
Widget makeDismissible({required context, required Widget child}) => Widget makeDismissible({required context, required Widget child}) =>
GestureDetector( GestureDetector(

View file

@ -58,9 +58,9 @@ class RegisterErrorState extends State<RegisterError> {
const SizedBox( const SizedBox(
height: 70, height: 70,
), ),
Row( const Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: const [ children: [
Flexible( Flexible(
child: Text( child: Text(
"An error has occured Make sure to check if your email has been registered before.", "An error has occured Make sure to check if your email has been registered before.",

View file

@ -2,9 +2,9 @@ import 'package:lottie/lottie.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/components/register_error.dart'; import 'package:nekoya_app/components/register_error.dart';
import 'package:nekoya_flutter/components/register_verify.dart'; import 'package:nekoya_app/components/register_verify.dart';
class RegisterForm extends StatefulWidget { class RegisterForm extends StatefulWidget {
const RegisterForm({Key? key}) : super(key: key); const RegisterForm({Key? key}) : super(key: key);
@ -144,7 +144,7 @@ class RegisterFormState extends State<RegisterForm> {
children: [ children: [
TextButton( TextButton(
style: TextButton.styleFrom( style: TextButton.styleFrom(
primary: Colors.transparent, foregroundColor: Colors.transparent,
), ),
child: const Text( child: const Text(
"Already have an account?? \nClick here to Sign In !!", "Already have an account?? \nClick here to Sign In !!",

View file

@ -58,9 +58,9 @@ class RegisterVerifyState extends State<RegisterVerify> {
const SizedBox( const SizedBox(
height: 50, height: 50,
), ),
Row( const Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: const [ children: [
Flexible( Flexible(
child: Text( child: Text(
"Before proceeding, please check your email for a verification link to verify your email address.", "Before proceeding, please check your email for a verification link to verify your email address.",

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:nekoya_flutter/components/search_page.dart'; import 'package:nekoya_app/components/search_page.dart';
import 'package:nekoya_flutter/utils/utils.dart'; import 'package:nekoya_app/utils/utils.dart';
const OutlineInputBorder outlineInputBorder = OutlineInputBorder( const OutlineInputBorder outlineInputBorder = OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(12)), borderRadius: BorderRadius.all(Radius.circular(12)),
@ -37,7 +37,8 @@ class _SearchFormState extends State<SearchForm> {
prefixIcon: Padding( prefixIcon: Padding(
padding: const EdgeInsets.all(14), padding: const EdgeInsets.all(14),
child: SvgPicture.asset("assets/icons/Search.svg", child: SvgPicture.asset("assets/icons/Search.svg",
color: Colors.white), colorFilter:
const ColorFilter.mode(Colors.white, BlendMode.srcIn)),
), ),
suffixIcon: Padding( suffixIcon: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@ -47,7 +48,7 @@ class _SearchFormState extends State<SearchForm> {
height: 48, height: 48,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: const Color(0xff8B0000), backgroundColor: const Color(0xff8B0000),
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12)), borderRadius: BorderRadius.all(Radius.circular(12)),
), ),

View file

@ -1,9 +1,9 @@
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/components/product_detail.dart'; import 'package:nekoya_app/components/product_detail.dart';
import 'package:nekoya_flutter/components/search_item.dart'; import 'package:nekoya_app/components/search_item.dart';
class SearchPage extends StatefulWidget { class SearchPage extends StatefulWidget {
const SearchPage({Key? key, required this.query}) : super(key: key); const SearchPage({Key? key, required this.query}) : super(key: key);
@ -25,39 +25,47 @@ class _SearchPageState extends State<SearchPage> {
backgroundColor: const Color(0xff212226), backgroundColor: const Color(0xff212226),
), ),
body: FutureBuilder<dynamic>( body: FutureBuilder<dynamic>(
future: getProducts(), future: getProducts(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
var data = snapshot.data; var data = snapshot.data;
var filteredData = data.where((x) => x['TITLE'].toLowerCase().contains(widget.query.toLowerCase()) ? true : false).toList(); var filteredData = data
return ListView.separated( .where((x) => x['TITLE']
separatorBuilder: (BuildContext context, int index) => const Divider(), .toLowerCase()
itemCount: filteredData.length, .contains(widget.query.toLowerCase())
itemBuilder: (context, index) { ? true
return SearchItem( : false)
title: filteredData[index]['TITLE'], .toList();
description: "Price : Rp ${NumberFormat('#,##0.00', 'ID').format(filteredData[index]['PRICE'])}", return ListView.separated(
imageUrl: "https://nekoya.moe.team/img/${filteredData[index]['IMAGE']}", separatorBuilder: (BuildContext context, int index) =>
callback: () { const Divider(),
showModalBottomSheet( itemCount: filteredData.length,
isScrollControlled: true, itemBuilder: (context, index) {
backgroundColor: Colors.transparent, return SearchItem(
context: context, title: filteredData[index]['TITLE'],
builder: (context) => productDetail(context, filteredData[index]['ID']), description:
"Price : Rp ${NumberFormat('#,##0.00', 'ID').format(filteredData[index]['PRICE'])}",
imageUrl:
"https://nekoya.moe.team/img/${filteredData[index]['IMAGE']}",
callback: () {
showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
context: context,
builder: (context) =>
productDetail(context, filteredData[index]['ID']),
);
},
); );
}, });
); }
}
return const Center(
child: CircularProgressIndicator(
color: Color(0xff8B0000),
),
); );
} }),
return const Center(
child: CircularProgressIndicator(
color: Color(0xff8B0000),
),
);
}
),
); );
} }
} }

View file

@ -16,7 +16,7 @@ class SectionTitle extends StatelessWidget {
children: [ children: [
Text( Text(
title, title,
style: Theme.of(context).textTheme.subtitle1!.copyWith( style: Theme.of(context).textTheme.titleMedium!.copyWith(
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 20.0, fontSize: 20.0,

View file

@ -2,26 +2,26 @@ import 'dart:convert';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/components/transaction_product_box.dart'; import 'package:nekoya_app/components/transaction_product_box.dart';
class TransactionBox extends StatefulWidget { class TransactionBox extends StatefulWidget {
const TransactionBox({ const TransactionBox(
Key? key, {Key? key,
required this.orderId, required this.orderId,
required this.status, required this.status,
required this.firstName, required this.firstName,
required this.lastName, required this.lastName,
required this.phoneNumber, required this.phoneNumber,
required this.streetAddress1, required this.streetAddress1,
required this.district, required this.district,
required this.subDistrict, required this.subDistrict,
required this.province, required this.province,
required this.region, required this.region,
required this.postalCode, required this.postalCode,
required this.logistic, required this.logistic,
required this.data required this.data})
}) : super(key: key); : super(key: key);
final int orderId; final int orderId;
final String status; final String status;
@ -54,7 +54,7 @@ class _TransactionBoxState extends State<TransactionBox> {
totalPrice += product[0]['PRICE'] * x['quantity']; totalPrice += product[0]['PRICE'] * x['quantity'];
}); });
return Future.delayed(const Duration(seconds: 2), (){ return Future.delayed(const Duration(seconds: 2), () {
return totalPrice; return totalPrice;
}); });
} }
@ -66,8 +66,14 @@ class _TransactionBoxState extends State<TransactionBox> {
title: Row( title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text('#${widget.orderId}', style: const TextStyle(color: Colors.white),), Text(
Text(widget.status, style: const TextStyle(color: Colors.white),) '#${widget.orderId}',
style: const TextStyle(color: Colors.white),
),
Text(
widget.status,
style: const TextStyle(color: Colors.white),
)
], ],
), ),
children: [ children: [
@ -78,15 +84,31 @@ class _TransactionBoxState extends State<TransactionBox> {
Flexible( Flexible(
flex: 2, flex: 2,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const Text('Sender Details', style: TextStyle(color: Colors.white, fontSize: 15, fontWeight: FontWeight.w600),), const Text(
const SizedBox(height: 5,), 'Sender Details',
Text("${widget.firstName} ${widget.lastName}", style: const TextStyle(color: Colors.white),), style: TextStyle(
Text(widget.phoneNumber, style: const TextStyle(color: Colors.white),), color: Colors.white,
Text("${widget.streetAddress1}, ${widget.district}, ${widget.subDistrict}, ${widget.province}, ${widget.region}, ${widget.postalCode}", style: const TextStyle(color: Colors.white),), fontSize: 15,
] fontWeight: FontWeight.w600),
), ),
const SizedBox(
height: 5,
),
Text(
"${widget.firstName} ${widget.lastName}",
style: const TextStyle(color: Colors.white),
),
Text(
widget.phoneNumber,
style: const TextStyle(color: Colors.white),
),
Text(
"${widget.streetAddress1}, ${widget.district}, ${widget.subDistrict}, ${widget.province}, ${widget.region}, ${widget.postalCode}",
style: const TextStyle(color: Colors.white),
),
]),
), ),
Flexible( Flexible(
flex: 1, flex: 1,
@ -96,9 +118,20 @@ class _TransactionBoxState extends State<TransactionBox> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
const Text('Logistic', style: TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.w600),), const Text(
const SizedBox(height: 5,), 'Logistic',
Text(widget.logistic, style: const TextStyle(color: Colors.white),), style: TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.w600),
),
const SizedBox(
height: 5,
),
Text(
widget.logistic,
style: const TextStyle(color: Colors.white),
),
], ],
), ),
), ),
@ -106,7 +139,6 @@ class _TransactionBoxState extends State<TransactionBox> {
], ],
), ),
), ),
Container( Container(
margin: const EdgeInsets.all(15.0), margin: const EdgeInsets.all(15.0),
child: Card( child: Card(
@ -117,77 +149,73 @@ class _TransactionBoxState extends State<TransactionBox> {
child: Column( child: Column(
children: [ children: [
ListView.builder( ListView.builder(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
itemCount: orderData.length, itemCount: orderData.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return FutureBuilder<dynamic>( return FutureBuilder<dynamic>(
future: getProduct(orderData[index]['product_id']), future: getProduct(orderData[index]['product_id']),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
var productData = snapshot.data; var productData = snapshot.data;
return TransactionProductBox( return TransactionProductBox(
imageUrl: 'https://nekoya.moe.team/img/${productData[0]['IMAGE']}', imageUrl:
title: productData[0]['TITLE'], 'https://nekoya.moe.team/img/${productData[0]['IMAGE']}',
quantity: orderData[index]["quantity"], title: productData[0]['TITLE'],
); quantity: orderData[index]["quantity"],
} );
}
return const TransactionProductBox(
imageUrl: 'https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp',
title: 'Loading...',
quantity: 0,
);
}
);
}
),
return const TransactionProductBox(
imageUrl:
'https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp',
title: 'Loading...',
quantity: 0,
);
});
}),
Container( Container(
margin: const EdgeInsets.only(left: 15.0, right: 15.0), margin: const EdgeInsets.only(left: 15.0, right: 15.0),
child: const Divider( child: const Divider(
color: Colors.white, color: Colors.white,
), ),
), ),
Container( Container(
margin: const EdgeInsets.only(top: 15.0, right: 15.0, bottom: 20.0), margin: const EdgeInsets.only(
top: 15.0, right: 15.0, bottom: 20.0),
child: FutureBuilder<dynamic>( child: FutureBuilder<dynamic>(
future: getTotal(), future: getTotal(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
var price = snapshot.data; var price = snapshot.data;
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
"Total : Rp ${NumberFormat('#,##0.00', 'ID').format(price)}",
style: const TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w600),
)
],
);
}
return const Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Text( Text(
"Total : Rp ${NumberFormat('#,##0.00', 'ID').format(price)}", "Total : -",
style: const TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w600 fontWeight: FontWeight.w600),
),
) )
], ],
); );
} }),
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: const [
Text(
"Total : -",
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w600
),
)
],
);
}
),
), ),
], ],
), ),
@ -196,4 +224,4 @@ class _TransactionBoxState extends State<TransactionBox> {
], ],
); );
} }
} }

View file

@ -1,13 +1,10 @@
import 'dart:convert'; import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
String getEncodedSession(userId, sessionToken) { String getEncodedSession(userId, sessionToken) {
var sessionData = { var sessionData = {"user_id": userId, "session_token": sessionToken};
"user_id": userId,
"session_token": sessionToken
};
var sessionRaw = jsonEncode(sessionData).toString(); var sessionRaw = jsonEncode(sessionData).toString();
var sessionEncoded = base64.encode(utf8.encode(sessionRaw)); var sessionEncoded = base64.encode(utf8.encode(sessionRaw));
return sessionEncoded; return sessionEncoded;
@ -52,4 +49,4 @@ Future<void> removeSession() async {
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
await prefs.remove('session'); await prefs.remove('session');
} }

View file

@ -1,14 +1,14 @@
import 'package:nekoya_flutter/screens/forgotpassword.dart'; import 'package:nekoya_app/screens/forgotpassword.dart';
import 'package:page_transition/page_transition.dart'; import 'package:page_transition/page_transition.dart';
import 'package:animated_splash_screen/animated_splash_screen.dart'; import 'package:animated_splash_screen/animated_splash_screen.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/screens/login.dart'; import 'package:nekoya_app/screens/login.dart';
import 'package:nekoya_flutter/screens/register.dart'; import 'package:nekoya_app/screens/register.dart';
import 'package:nekoya_flutter/screens/payment.dart'; import 'package:nekoya_app/screens/payment.dart';
import 'package:nekoya_flutter/components/menu.dart'; import 'package:nekoya_app/components/menu.dart';
import 'package:nekoya_flutter/utils/navigation_auth.dart'; import 'package:nekoya_app/utils/navigation_auth.dart';
void main() { void main() {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();

View file

@ -1,5 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/components/about_us_body.dart'; import 'package:nekoya_app/components/about_us_body.dart';
class AboutUs extends StatefulWidget { class AboutUs extends StatefulWidget {
const AboutUs({Key? key}) : super(key: key); const AboutUs({Key? key}) : super(key: key);

View file

@ -1,12 +1,12 @@
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/components/cart_box.dart'; import 'package:nekoya_app/components/cart_box.dart';
import 'package:nekoya_flutter/components/cart_button.dart'; import 'package:nekoya_app/components/cart_button.dart';
import 'package:nekoya_flutter/components/menu.dart'; import 'package:nekoya_app/components/menu.dart';
import 'package:nekoya_flutter/data/cart.dart'; import 'package:nekoya_app/data/cart.dart';
import 'package:nekoya_flutter/screens/checkout.dart'; import 'package:nekoya_app/screens/checkout.dart';
class Cart extends StatefulWidget { class Cart extends StatefulWidget {
const Cart({Key? key}) : super(key: key); const Cart({Key? key}) : super(key: key);
@ -20,7 +20,6 @@ class _CartState extends State<Cart> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Future<dynamic> getTotal() async { Future<dynamic> getTotal() async {
dynamic totalPrice = 0; dynamic totalPrice = 0;
var orderData = await viewCart(); var orderData = await viewCart();
@ -47,119 +46,118 @@ class _CartState extends State<Cart> {
body: Container( body: Container(
margin: const EdgeInsets.only(bottom: 80.0), margin: const EdgeInsets.only(bottom: 80.0),
child: FutureBuilder<dynamic>( child: FutureBuilder<dynamic>(
future: _viewCart, future: _viewCart,
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
var data = snapshot.data; var data = snapshot.data;
if (data.isNotEmpty) { if (data.isNotEmpty) {
return ListView.builder( return ListView.builder(
itemCount: data!.length, itemCount: data!.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return FutureBuilder<dynamic>( return FutureBuilder<dynamic>(
future: getProduct(data[index]["product_id"]), future: getProduct(data[index]["product_id"]),
builder: (context, snapshotx) { builder: (context, snapshotx) {
if (snapshotx.hasData) { if (snapshotx.hasData) {
var productData = snapshotx.data; var productData = snapshotx.data;
if (productData != null) { if (productData != null) {
return CartBox(
controller: true,
imageUrl:
"https://nekoya.moe.team/img/${productData[0]['IMAGE']}",
title: productData[0]['TITLE'],
quantity: data[index]["quantity"],
plus: () {
addToCart(data[index]["product_id"]);
setState(() {
_viewCart = viewCart();
getTotal_ = getTotal();
});
},
minus: () {
removeFromCart(
data[index]["product_id"], false);
setState(() {
_viewCart = viewCart();
getTotal_ = getTotal();
});
},
remove: () {
removeFromCart(
data[index]["product_id"], true);
setState(() {
_viewCart = viewCart();
getTotal_ = getTotal();
});
});
}
}
return CartBox( return CartBox(
controller: true, controller: true,
imageUrl: "https://nekoya.moe.team/img/${productData[0]['IMAGE']}", imageUrl:
title: productData[0]['TITLE'], 'https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp',
quantity: data[index]["quantity"], title: 'Loading...',
plus: () { quantity: 0,
addToCart(data[index]["product_id"]); plus: () {},
setState(() { minus: () {},
_viewCart = viewCart(); remove: () {},
getTotal_ = getTotal();
});
},
minus: () {
removeFromCart(data[index]["product_id"], false);
setState(() {
_viewCart = viewCart();
getTotal_ = getTotal();
});
},
remove: () {
removeFromCart(data[index]["product_id"], true);
setState(() {
_viewCart = viewCart();
getTotal_ = getTotal();
});
}
); );
} });
} },
);
return CartBox( } else {
controller: true, return Padding(
imageUrl: 'https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp', padding: const EdgeInsets.only(bottom: 200.0),
title: 'Loading...', child: Container(
quantity: 0, decoration: const BoxDecoration(
plus: () {}, image: DecorationImage(
minus: () {}, image: AssetImage(
remove: () {}, 'assets/images/image_empty.webp'))),
);
}
);
},
);
} else {
return Padding(
padding: const EdgeInsets.only(bottom: 200.0),
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/image_empty.webp')
)
), ),
), );
); }
} }
}
return const Center( return const Center(
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: Color(0xff8B0000), color: Color(0xff8B0000),
), ),
); );
} }),
),
), ),
floatingActionButton: FutureBuilder<dynamic>( floatingActionButton: FutureBuilder<dynamic>(
future: getTotal_, future: getTotal_,
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
var price = snapshot.data; var price = snapshot.data;
if (price != 0) { if (price != 0) {
return CartButton(
icon: const Icon(Icons.shopping_cart_checkout),
text1: "Rp ${NumberFormat('#,##0.00', 'ID').format(price)}",
text2: "Checkout",
refer: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => const Checkout()));
},
);
}
return CartButton( return CartButton(
icon: const Icon(Icons.shopping_cart_checkout), icon: const Icon(Icons.shopping_cart_outlined),
text1: "Rp ${NumberFormat('#,##0.00', 'ID').format(price)}", text1: "Cart is Empty",
text2: "Checkout", text2: "Shop Now",
refer: () { refer: () {
Navigator.of(context).push(MaterialPageRoute( Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => const Checkout()) builder: (context) => const Menu(initialScreen: 2)));
);
}, },
); );
} }
return CartButton( return const SizedBox(
icon: const Icon(Icons.shopping_cart_outlined), width: 1.0,
text1: "Cart is Empty",
text2: "Shop Now",
refer: () {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => const Menu(initialScreen: 2))
);
},
); );
} }),
return const SizedBox(width: 1.0,);
}
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
); );
} }
} }

View file

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/components/checkout_form.dart'; import 'package:nekoya_app/components/checkout_form.dart';
import 'package:nekoya_flutter/components/checkout_items.dart'; import 'package:nekoya_app/components/checkout_items.dart';
class Checkout extends StatefulWidget { class Checkout extends StatefulWidget {
const Checkout({Key? key}) : super(key: key); const Checkout({Key? key}) : super(key: key);
@ -20,10 +20,10 @@ class _CheckoutState extends State<Checkout> {
centerTitle: true, centerTitle: true,
backgroundColor: const Color(0xff212226), backgroundColor: const Color(0xff212226),
), ),
body: SafeArea( body: const SafeArea(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: const [ children: [
CheckoutItems(), CheckoutItems(),
CheckoutForm(), CheckoutForm(),
], ],

View file

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/components/faq_body.dart'; import 'package:nekoya_app/components/faq_body.dart';
class FAQ extends StatefulWidget { class FAQ extends StatefulWidget {
const FAQ({Key? key}) : super(key: key); const FAQ({Key? key}) : super(key: key);
@ -13,13 +13,12 @@ class _FAQState extends State<FAQ> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: const Color(0xff1b1c1e), backgroundColor: const Color(0xff1b1c1e),
appBar: AppBar( appBar: AppBar(
title: const Text('FAQ'), title: const Text('FAQ'),
centerTitle: true, centerTitle: true,
backgroundColor: const Color(0xff212226), backgroundColor: const Color(0xff212226),
), ),
body: const FAQBody() body: const FAQBody());
);
} }
} }

View file

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/components/forgot_pass_body.dart'; import 'package:nekoya_app/components/forgot_pass_body.dart';
class ForgotPassword extends StatefulWidget { class ForgotPassword extends StatefulWidget {
const ForgotPassword({Key? key}) : super(key: key); const ForgotPassword({Key? key}) : super(key: key);

View file

@ -1,14 +1,14 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/components/bannerimage.dart'; import 'package:nekoya_app/components/bannerimage.dart';
import 'package:nekoya_flutter/components/carousel.dart'; import 'package:nekoya_app/components/carousel.dart';
import 'package:nekoya_flutter/components/new_arrival_products.dart'; import 'package:nekoya_app/components/new_arrival_products.dart';
import 'package:nekoya_flutter/components/newsletter.dart'; import 'package:nekoya_app/components/newsletter.dart';
import 'package:nekoya_flutter/components/popular_products.dart'; import 'package:nekoya_app/components/popular_products.dart';
import 'package:nekoya_flutter/components/search_form.dart'; import 'package:nekoya_app/components/search_form.dart';
import 'package:nekoya_flutter/screens/about_us.dart'; import 'package:nekoya_app/screens/about_us.dart';
import 'package:nekoya_flutter/screens/faq.dart'; import 'package:nekoya_app/screens/faq.dart';
import 'package:nekoya_flutter/utils/utils.dart'; import 'package:nekoya_app/utils/utils.dart';
class Home extends StatelessWidget { class Home extends StatelessWidget {
const Home({Key? key}) : super(key: key); const Home({Key? key}) : super(key: key);
@ -51,7 +51,7 @@ class Home extends StatelessWidget {
"Explore", "Explore",
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.headline4! .headlineMedium!
.copyWith(fontWeight: FontWeight.w500, color: Colors.white), .copyWith(fontWeight: FontWeight.w500, color: Colors.white),
), ),
const Text( const Text(

View file

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/components/login_form.dart'; import 'package:nekoya_app/components/login_form.dart';
class Login extends StatefulWidget { class Login extends StatefulWidget {
const Login({Key? key}) : super(key: key); const Login({Key? key}) : super(key: key);

View file

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/components/otp_body.dart'; import 'package:nekoya_app/components/otp_body.dart';
class Otp extends StatefulWidget { class Otp extends StatefulWidget {
const Otp({Key? key, required this.otpToken}) : super(key: key); const Otp({Key? key, required this.otpToken}) : super(key: key);
@ -21,7 +21,9 @@ class _OtpState extends State<Otp> {
centerTitle: true, centerTitle: true,
backgroundColor: const Color(0xff212226), backgroundColor: const Color(0xff212226),
), ),
body: OtpBody(otpToken: widget.otpToken,), body: OtpBody(
otpToken: widget.otpToken,
),
); );
} }
} }

View file

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/components/payment_body.dart'; import 'package:nekoya_app/components/payment_body.dart';
class Payment extends StatefulWidget { class Payment extends StatefulWidget {
const Payment({Key? key}) : super(key: key); const Payment({Key? key}) : super(key: key);

View file

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/components/product_box.dart'; import 'package:nekoya_app/components/product_box.dart';
import 'package:nekoya_flutter/components/product_detail.dart'; import 'package:nekoya_app/components/product_detail.dart';
import 'package:nekoya_flutter/utils/utils.dart' import 'package:nekoya_app/utils/utils.dart'
show kMobileBreakpoint, kTabletBreakpoint, kDesktopBreakPoint; show kMobileBreakpoint, kTabletBreakpoint, kDesktopBreakPoint;
class Products extends StatefulWidget { class Products extends StatefulWidget {

View file

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/components/register_form.dart'; import 'package:nekoya_app/components/register_form.dart';
class Register extends StatefulWidget { class Register extends StatefulWidget {
const Register({Key? key}) : super(key: key); const Register({Key? key}) : super(key: key);

View file

@ -1,10 +1,10 @@
import 'package:universal_html/html.dart' as html; import 'package:universal_html/html.dart' as html;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/components/menu.dart'; import 'package:nekoya_app/components/menu.dart';
import 'package:nekoya_flutter/components/session_box.dart'; import 'package:nekoya_app/components/session_box.dart';
import 'package:nekoya_flutter/data/auth.dart'; import 'package:nekoya_app/data/auth.dart';
class Sessions extends StatefulWidget { class Sessions extends StatefulWidget {
const Sessions({Key? key}) : super(key: key); const Sessions({Key? key}) : super(key: key);
@ -19,7 +19,7 @@ class _SessionsState extends State<Sessions> {
var session = await getSession(); var session = await getSession();
var data = await getSessions(session); var data = await getSessions(session);
return data; return data;
} catch(e) { } catch (e) {
return []; return [];
} }
} }
@ -27,75 +27,81 @@ class _SessionsState extends State<Sessions> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: const Color(0xff1b1c1e), backgroundColor: const Color(0xff1b1c1e),
appBar: AppBar( appBar: AppBar(
title: const Text('Active Sessions'), title: const Text('Active Sessions'),
centerTitle: true, centerTitle: true,
backgroundColor: const Color(0xff212226), backgroundColor: const Color(0xff212226),
actions: [ actions: [
IconButton( IconButton(
icon: const Icon(Icons.logout), icon: const Icon(Icons.logout),
onPressed: () { onPressed: () {
removeSession(); removeSession();
showDialog( showDialog(
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: const Text('Log out', style: TextStyle(color: Colors.white),), title: const Text(
backgroundColor: const Color(0xff212226), 'Log out',
content: SingleChildScrollView( style: TextStyle(color: Colors.white),
child: ListBody( ),
children: const <Widget>[ backgroundColor: const Color(0xff212226),
Text('You have successfully logged out', style: TextStyle( content: const SingleChildScrollView(
color: Colors.white child: ListBody(
)), children: <Widget>[
Text('You have successfully logged out',
style: TextStyle(color: Colors.white)),
],
),
),
actions: <Widget>[
TextButton(
child: const Text(
'Close',
style: TextStyle(color: Colors.white),
),
onPressed: () {
Navigator.of(context).pop();
html.window.history.pushState(null, '', '');
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) =>
const Menu(initialScreen: 2)));
},
),
], ],
), );
), });
actions: <Widget>[ },
TextButton( )
child: const Text('Close', style: TextStyle(color: Colors.white),), ],
onPressed: () { ),
Navigator.of(context).pop(); body: FutureBuilder<dynamic>(
html.window.history.pushState(null, '', ''); future: loadSessions(),
Navigator.of(context).pushReplacement(MaterialPageRoute( builder: (context, snapshot) {
builder: (context) => const Menu(initialScreen: 2)) if (snapshot.hasData) {
); var listSessions = snapshot.data;
}, return ListView.builder(
), itemCount: listSessions['data']!.length,
], itemBuilder: (context, index) {
); return SessionBox(
} icon: const Icon(
); Icons.key,
}, color: Colors.white,
) size: 50,
], ),
), ip: listSessions['data'][index]['ip'].split(', ')[0],
body: FutureBuilder<dynamic>( userAgent: listSessions['data'][index]['user_agent'],
future: loadSessions(), );
builder: (context, snapshot) { });
if (snapshot.hasData) {
var listSessions = snapshot.data;
return ListView.builder(
itemCount: listSessions['data']!.length,
itemBuilder: (context, index) {
return SessionBox(
icon: const Icon(Icons.key, color: Colors.white, size: 50,),
ip: listSessions['data'][index]['ip'].split(', ')[0],
userAgent: listSessions['data'][index]['user_agent'],
);
} }
);
}
return const Center( return const Center(
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: Color(0xff8B0000), color: Color(0xff8B0000),
), ),
); );
} }));
)
);
} }
} }

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/api/api.dart'; import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_flutter/components/transaction_box.dart'; import 'package:nekoya_app/components/transaction_box.dart';
import 'package:nekoya_flutter/data/auth.dart'; import 'package:nekoya_app/data/auth.dart';
class Transactions extends StatefulWidget { class Transactions extends StatefulWidget {
const Transactions({Key? key}) : super(key: key); const Transactions({Key? key}) : super(key: key);
@ -17,7 +17,7 @@ class _TransactionsState extends State<Transactions> {
var session = await getSession(); var session = await getSession();
var data = await getTransactions(session); var data = await getTransactions(session);
return data; return data;
} catch(e) { } catch (e) {
return []; return [];
} }
} }
@ -25,46 +25,43 @@ class _TransactionsState extends State<Transactions> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: const Color(0xff1b1c1e), backgroundColor: const Color(0xff1b1c1e),
appBar: AppBar( appBar: AppBar(
title: const Text('Transactions'), title: const Text('Transactions'),
centerTitle: true, centerTitle: true,
backgroundColor: const Color(0xff212226), backgroundColor: const Color(0xff212226),
), ),
body: FutureBuilder<dynamic>( body: FutureBuilder<dynamic>(
future: loadTransaction(), future: loadTransaction(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
var data = snapshot.data; var data = snapshot.data;
return ListView.builder( return ListView.builder(
itemCount: data!.length, itemCount: data!.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return TransactionBox( return TransactionBox(
orderId: data[index]['id'], orderId: data[index]['id'],
status: data[index]['status'], status: data[index]['status'],
firstName: data[index]['firstName'], firstName: data[index]['firstName'],
lastName: data[index]['lastName'], lastName: data[index]['lastName'],
phoneNumber: data[index]['phoneNumber'], phoneNumber: data[index]['phoneNumber'],
streetAddress1: data[index]['streetAddress1'], streetAddress1: data[index]['streetAddress1'],
district: data[index]['district'], district: data[index]['district'],
subDistrict: data[index]['subDistrict'], subDistrict: data[index]['subDistrict'],
province: data[index]['province'], province: data[index]['province'],
region: data[index]['region'], region: data[index]['region'],
postalCode: data[index]['postalCode'], postalCode: data[index]['postalCode'],
logistic: data[index]['logistic'], logistic: data[index]['logistic'],
data: data[index]['data'], data: data[index]['data'],
); );
});
} }
);
}
return const Center( return const Center(
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: Color(0xff8B0000), color: Color(0xff8B0000),
), ),
); );
} }));
)
);
} }
} }

View file

@ -1,8 +1,8 @@
import 'package:universal_html/html.dart' as html; import 'package:universal_html/html.dart' as html;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:nekoya_flutter/data/auth.dart'; import 'package:nekoya_app/data/auth.dart';
import 'package:nekoya_flutter/screens/login.dart'; import 'package:nekoya_app/screens/login.dart';
class NavigationAuth extends StatelessWidget { class NavigationAuth extends StatelessWidget {
const NavigationAuth({Key? key, required this.route}) : super(key: key); const NavigationAuth({Key? key, required this.route}) : super(key: key);
@ -11,26 +11,24 @@ class NavigationAuth extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return FutureBuilder<dynamic>( return FutureBuilder<dynamic>(
future: checkSessionExist(), future: checkSessionExist(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.hasData) { if (snapshot.hasData) {
var data = snapshot.data; var data = snapshot.data;
if (data) { if (data) {
return route; return route;
} else {
html.window.history.pushState(null, '', '/#/login');
return const Login();
}
} else { } else {
html.window.history.pushState(null, '', '/#/login'); return const Center(
return const Login(); child: CircularProgressIndicator(
color: Color(0xff8B0000),
),
);
} }
} else { });
return const Center(
child: CircularProgressIndicator(
color: Color(0xff8B0000),
),
);
}
}
);
} }
} }

View file

@ -1,9 +1,9 @@
@echo off @echo off
echo "=== WORKSPACE SCRIPT RUNNING ===" echo "=== WORKSPACE SCRIPT RUNNING ==="
mkdir nekoya_flutter mkdir nekoya_app
cd nekoya_flutter cd nekoya_app
git clone https://gitlab.com/nekoya/app.git . git clone https://gitlab.com/nekoya/app.git .
flutter create . flutter create .
flutter pub get flutter pub get
flutter pub run flutter_launcher_icons_maker:main flutter pub run flutter_launcher_icons
echo "=== DONE :3 ===" echo "=== DONE :3 ==="

View file

@ -1,8 +1,8 @@
echo "=== WORKSPACE SCRIPT RUNNING ===" echo "=== WORKSPACE SCRIPT RUNNING ==="
mkdir nekoya_flutter mkdir nekoya_app
cd nekoya_flutter cd nekoya_app
git clone https://gitlab.com/nekoya/app.git . git clone https://gitlab.com/nekoya/app.git .
flutter create . flutter create .
flutter pub get flutter pub get
flutter pub run flutter_launcher_icons_maker:main flutter pub run flutter_launcher_icons
echo "=== DONE :3 ===" echo "=== DONE :3 ==="