Compare commits

...

13 commits
main ... techno

Author SHA1 Message Date
cd70d0039a Update version to 1.2.0
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-11-18 16:27:26 +07:00
f136329a5d Change discount label font size 2023-11-18 16:25:10 +07:00
ae7d84443d Add size to cart 2023-11-18 16:23:42 +07:00
8d2c19ff0a Update dependencies 2023-11-18 16:23:07 +07:00
ba32b68027 Update version to 1.1.2
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-11-13 12:25:09 +07:00
6622d0340d Add limitation to checkout 2023-11-13 12:24:10 +07:00
52aa043fdb Change loading placeholder 2023-11-13 12:23:40 +07:00
31b1e5765a Update cart empty image 2023-11-13 12:22:52 +07:00
3add62af69 Update version to 1.1.1
Some checks reported errors
continuous-integration/drone/push Build was killed
2023-11-10 21:38:21 +07:00
46e050675f Update banner 2023-11-10 21:32:01 +07:00
835bf87bae Remove checkout form 2023-11-10 21:23:14 +07:00
d74ed5bcfa Add discounts page 2023-11-10 20:55:31 +07:00
cd5989beb5 Remove newsletter 2023-11-10 20:43:13 +07:00
21 changed files with 268 additions and 399 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -27,7 +27,7 @@ class Bannerimage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'SPRING / SUMMER COLLECTION 2022',
'FALL 2023 SALE!',
style: TextStyle(
color: Colors.black,
fontSize: 10.5,
@ -37,7 +37,7 @@ class Bannerimage extends StatelessWidget {
height: 8.0,
),
const Text(
'Get up to 30% off \nNow Arrivals',
'Get up to 30% off \nNew Collections',
style: TextStyle(
color: Colors.black,
fontSize: 20.0,
@ -48,7 +48,7 @@ class Bannerimage extends StatelessWidget {
),
ElevatedButton(
onPressed: () {
Navigator.pushReplacementNamed(context, '/products');
Navigator.pushReplacementNamed(context, '/discounts');
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,

View file

@ -31,7 +31,9 @@ class _CarouselState extends State<Carousel> {
width: 1000,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/image_empty.webp'), fit: BoxFit.cover)),
image: AssetImage(
'assets/images/logo_transparent.webp'),
fit: BoxFit.contain)),
),
errorWidget: (context, url, error) =>
Image.asset('assets/images/image_error.webp'),
@ -73,15 +75,13 @@ class _CarouselState extends State<Carousel> {
@override
Widget build(BuildContext context) {
return CarouselSlider(
items: imageSliders,
carouselController: _controller,
options: CarouselOptions(
aspectRatio: 2.0,
enlargeCenterPage: true,
enableInfiniteScroll: false,
initialPage: 2,
autoPlay: true
)
);
items: imageSliders,
carouselController: _controller,
options: CarouselOptions(
aspectRatio: 2.0,
enlargeCenterPage: true,
enableInfiniteScroll: false,
initialPage: 2,
autoPlay: true));
}
}

View file

@ -2,21 +2,23 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
class CartBox extends StatefulWidget {
const CartBox({
Key? key,
required this.controller,
required this.imageUrl,
required this.title,
required this.quantity,
required this.plus,
required this.minus,
required this.remove
}) : super(key: key);
const CartBox(
{Key? key,
required this.controller,
required this.imageUrl,
required this.title,
required this.quantity,
required this.size,
required this.plus,
required this.minus,
required this.remove})
: super(key: key);
final bool controller;
final String imageUrl;
final String title;
final int quantity;
final List<dynamic> size;
final Function() plus;
final Function() minus;
final Function() remove;
@ -26,10 +28,8 @@ class CartBox extends StatefulWidget {
}
class _CartBoxState extends State<CartBox> {
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(8.0),
child: Card(
@ -43,8 +43,7 @@ class _CartBoxState extends State<CartBox> {
flex: 2,
child: CachedNetworkImage(
imageUrl: widget.imageUrl,
placeholder: (context, url) =>
const CircularProgressIndicator(
placeholder: (context, url) => const CircularProgressIndicator(
color: Color(0xff8B0000),
),
errorWidget: (context, url, error) =>
@ -64,62 +63,78 @@ class _CartBoxState extends State<CartBox> {
child: Column(
children: [
Container(
margin: const EdgeInsets.only(left:10.0, right: 10.0),
margin: const EdgeInsets.only(left: 10.0, right: 10.0),
child: Text(
widget.title,
style: const TextStyle(
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.w600),
fontSize: 18,
color: Colors.white,
fontWeight: FontWeight.w600),
textAlign: TextAlign.start,
),
),
const SizedBox(height: 10,),
widget.controller == true ? Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
ElevatedButton(
onPressed: (){
widget.minus();
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(const Color(0xff8B0000)),
),
child: const Text("-")
),
Text(widget.quantity.toString(),
style: const TextStyle(
fontSize: 15,
color: Colors.white,
fontWeight: FontWeight.w400)
),
ElevatedButton(
onPressed: (){
widget.plus();
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(const Color(0xff8B0000)),
),
child: const Text("+")
)
],
)
: Container(
margin: const EdgeInsets.only(left: 10.0, right: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Quantity : ${widget.quantity.toString()}",
style: const TextStyle(
fontSize: 15,
color: Colors.white,
fontWeight: FontWeight.w400
),
),
],
),
const SizedBox(
height: 10,
),
widget.controller == true
? Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
ElevatedButton(
onPressed: () {
widget.minus();
},
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all<Color>(
const Color(0xff8B0000)),
),
child: const Text("-")),
Text(widget.quantity.toString(),
style: const TextStyle(
fontSize: 15,
color: Colors.white,
fontWeight: FontWeight.w400)),
ElevatedButton(
onPressed: () {
widget.plus();
},
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all<Color>(
const Color(0xff8B0000)),
),
child: const Text("+"))
],
)
: Container(
margin:
const EdgeInsets.only(left: 10.0, right: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Quantity : ${widget.quantity.toString()}",
style: const TextStyle(
fontSize: 15,
color: Colors.white,
fontWeight: FontWeight.w400),
),
],
),
),
Container(
margin: const EdgeInsets.all(5.0),
child: Text(
"Size : ${widget.size.join(', ')}",
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.w300,
color: Colors.white,
),
textAlign: TextAlign.left,
),
)
],
),
),
@ -128,4 +143,4 @@ class _CartBoxState extends State<CartBox> {
),
);
}
}
}

View file

@ -1,6 +1,5 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_app/data/auth.dart';
@ -13,8 +12,6 @@ class CheckoutForm extends StatefulWidget {
State<CheckoutForm> createState() => _CheckoutFormState();
}
final _formKey = GlobalKey<FormBuilderState>();
class _CheckoutFormState extends State<CheckoutForm> {
Future<dynamic> loadCheckout(checkoutData) async {
var session = await getSession();
@ -23,47 +20,29 @@ class _CheckoutFormState extends State<CheckoutForm> {
}
Future submitForm(BuildContext context) async {
if (_formKey.currentState!.fields["First Name"]!.value.isEmpty ||
_formKey.currentState!.fields["Last Name"]!.value.isEmpty ||
_formKey.currentState!.fields["Phone Number"]!.value.isEmpty ||
_formKey.currentState!.fields["Street Address"]!.value.isEmpty ||
_formKey.currentState!.fields["Street Address 2"]!.value.isEmpty ||
_formKey.currentState!.fields["Region"]!.value.isEmpty ||
_formKey.currentState!.fields["Province"]!.value.isEmpty ||
_formKey.currentState!.fields["City"]!.value.isEmpty ||
_formKey.currentState!.fields["District"]!.value.isEmpty ||
_formKey.currentState!.fields["Subdistrict"]!.value.isEmpty ||
_formKey.currentState!.fields["Postal Code"]!.value.isEmpty ||
!(_formKey.currentState!.fields["Shipping Method"]!.value == 'JNE' ||
_formKey.currentState!.fields["Shipping Method"]!.value == 'JNT' ||
_formKey.currentState!.fields["Shipping Method"]!.value ==
'SiCepat')) {
return 999;
} else {
var currentCart = await viewCart();
var cartData = jsonEncode(currentCart).toString();
var currentCart = await viewCart();
var cartData = jsonEncode(currentCart).toString();
Map<String, dynamic> data = {
"firstName": _formKey.currentState!.fields["First Name"]!.value,
"lastName": _formKey.currentState!.fields["Last Name"]!.value,
"phoneNumber": _formKey.currentState!.fields["Phone Number"]!.value,
"streetAddress1":
_formKey.currentState!.fields["Street Address"]!.value,
"streetAddress2":
_formKey.currentState!.fields["Street Address 2"]!.value,
"region": _formKey.currentState!.fields["Region"]!.value,
"province": _formKey.currentState!.fields["Province"]!.value,
"city": _formKey.currentState!.fields["City"]!.value,
"district": _formKey.currentState!.fields["District"]!.value,
"subDistrict": _formKey.currentState!.fields["Subdistrict"]!.value,
"postalCode": _formKey.currentState!.fields["Postal Code"]!.value,
"logistic": _formKey.currentState!.fields["Shipping Method"]!.value,
"data": cartData,
};
Map<String, dynamic> data = {
"firstName": 'Moe',
"lastName": 'Poi',
"phoneNumber": '081234567890',
"streetAddress1": 'isekai',
"streetAddress2": '-',
"region": '-',
"province": '-',
"city": '-',
"district": '-',
"subDistrict": '-',
"postalCode": '12345',
"logistic": 'JNE',
"data": cartData,
};
var statusCode = await loadCheckout(data);
return statusCode;
}
await clearCart();
var statusCode = await loadCheckout(data);
return statusCode;
}
@override
@ -84,166 +63,6 @@ class _CheckoutFormState extends State<CheckoutForm> {
children: [
Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25),
child: FormBuilder(
key: _formKey,
child: Column(
children: [
const Center(
child: Text(
"Shipping Details",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 30),
),
),
const SizedBox(
height: 20,
),
const Row(
children: [
Text(
"Contact Information",
style: TextStyle(
color: Colors.white70,
fontWeight: FontWeight.bold,
fontSize: 20),
),
],
),
const SizedBox(
height: 10,
),
makeInput(
label: "First Name",
icon: Icons.person,
keyboardType: TextInputType.name),
makeInput(
label: "Last Name",
icon: Icons.person,
keyboardType: TextInputType.name),
makeInput(
label: "Phone Number",
icon: Icons.phone_rounded,
keyboardType: TextInputType.phone),
const SizedBox(
height: 20,
),
const Row(
children: [
Text(
"Address",
style: TextStyle(
color: Colors.white70,
fontWeight: FontWeight.bold,
fontSize: 20),
),
],
),
const SizedBox(
height: 10,
),
makeInput(
label: "Street Address",
icon: Icons.home,
keyboardType: TextInputType.streetAddress),
makeInput(
label: "Street Address 2",
icon: Icons.home,
keyboardType: TextInputType.streetAddress),
makeInput(
label: "Region",
icon: Icons.location_city,
keyboardType: TextInputType.streetAddress),
makeInput(
label: "Province",
icon: Icons.location_city,
keyboardType: TextInputType.streetAddress),
makeInput(
label: "City",
icon: Icons.location_city,
keyboardType: TextInputType.streetAddress),
makeInput(
label: "District",
icon: Icons.location_city,
keyboardType: TextInputType.streetAddress),
makeInput(
label: "Subdistrict",
icon: Icons.location_city,
keyboardType: TextInputType.streetAddress),
makeInput(
label: "Postal Code",
icon: Icons.location_city,
keyboardType: TextInputType.number),
const SizedBox(
height: 20,
),
const Row(
children: [
Text(
"Shipping Methods",
style: TextStyle(
color: Colors.white70,
fontWeight: FontWeight.bold,
fontSize: 20),
),
],
),
const SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
color: const Color(0xff1b1c1e),
borderRadius: BorderRadius.circular(10.0),
boxShadow: const [
BoxShadow(
color: Colors.black12,
blurRadius: 6.0,
offset: Offset(0, 2),
),
],
),
child: FormBuilderDropdown(
name: "Shipping Method",
dropdownColor: const Color(0xff212226),
style: const TextStyle(color: Colors.white),
decoration: const InputDecoration(
contentPadding: EdgeInsets.symmetric(
vertical: 0, horizontal: 10),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
),
),
enabledBorder: InputBorder.none,
border: InputBorder.none,
),
items: const [
DropdownMenuItem(
value: "JNE",
child: Text("JNE"),
),
DropdownMenuItem(
value: "JNT",
child: Text("JNT"),
),
DropdownMenuItem(
value: "SiCepat",
child: Text("SiCepat"),
),
],
),
),
const SizedBox(
height: 20,
),
],
),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 35),
child: Container(
@ -255,14 +74,8 @@ class _CheckoutFormState extends State<CheckoutForm> {
onPressed: () {
checkSessionExist().then((isLoggedIn) {
if (isLoggedIn) {
submitForm(context).then((statusCode) {
if (statusCode == 201) {
Navigator.pushReplacementNamed(
context, '/payment');
} else if (statusCode == 999) {
showAlertDialog(context);
}
});
clearCart()
.then((value) => showAlertDialog(context));
} else {
Navigator.pushNamed(context, '/login');
}
@ -292,64 +105,12 @@ class _CheckoutFormState extends State<CheckoutForm> {
}
}
Widget makeInput({label, obscureText = false, icon, keyboardType}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: const TextStyle(
fontSize: 12, fontWeight: FontWeight.bold, color: Colors.white),
),
const SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
color: const Color(0xff1b1c1e),
borderRadius: BorderRadius.circular(10.0),
boxShadow: const [
BoxShadow(
color: Colors.black12,
blurRadius: 6.0,
offset: Offset(0, 2),
),
],
),
child: FormBuilderTextField(
initialValue: "",
name: label,
keyboardType: keyboardType,
obscureText: obscureText,
style: const TextStyle(color: Colors.white),
decoration: InputDecoration(
prefixIcon: Icon(
icon,
color: Colors.white,
),
contentPadding: const EdgeInsets.only(top: 14.0),
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(
color: Colors.red,
),
borderRadius: BorderRadius.circular(10.0)),
enabledBorder: InputBorder.none,
border: InputBorder.none,
),
),
),
const SizedBox(
height: 10,
)
],
);
}
showAlertDialog(BuildContext context) {
Widget okButton = TextButton(
child: const Text("OK", style: TextStyle(color: Colors.red)),
child: const Text("OK", style: TextStyle(color: Colors.white)),
onPressed: () {
Navigator.of(context, rootNavigator: true).pop();
Navigator.pop(context);
Navigator.pushReplacementNamed(context, '/products');
},
);
AlertDialog alert = AlertDialog(
@ -357,12 +118,8 @@ showAlertDialog(BuildContext context) {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
title: const Text(
"Error",
style: TextStyle(color: Colors.white),
),
content: const Text(
"Make sure to fill all fields",
"Coming Soon",
style: TextStyle(color: Colors.white70),
),
actions: [

View file

@ -72,6 +72,7 @@ class _CheckoutItemsState extends State<CheckoutItems> {
"https://nekoya.moe.team/img/${productData[0]['IMAGE']}",
title: productData[0]['TITLE'],
quantity: data[index]["quantity"],
size: data[index]["size"],
plus: () {},
minus: () {},
remove: () {});
@ -81,9 +82,10 @@ class _CheckoutItemsState extends State<CheckoutItems> {
return CartBox(
controller: false,
imageUrl:
'https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp',
'https://telegra.ph/file/75f075e858198e4e7898a.png',
title: 'Loading...',
quantity: 0,
size: const [],
plus: () {},
minus: () {},
remove: () {},

View file

@ -25,7 +25,7 @@ class LoginFormState extends State<LoginForm> {
Map<String, dynamic> data = {
"email": emailController.text,
"password": passwordController.text,
"ua": "Nekoya App v1.1.0"
"ua": "Nekoya App v1.2.0"
};
var response = await loginPost(data);

View file

@ -4,8 +4,8 @@ import 'package:flutter/material.dart';
import 'package:nekoya_app/data/auth.dart';
import 'package:nekoya_app/screens/products.dart';
import 'package:nekoya_app/screens/discounts.dart';
import 'package:nekoya_app/screens/cart.dart';
import 'package:nekoya_app/screens/sessions.dart';
import 'package:nekoya_app/screens/transactions.dart';
import 'package:nekoya_app/screens/home.dart';
@ -25,7 +25,7 @@ class _MenuState extends State<Menu> {
@override
void initState() {
if (widget.initialScreen == 0) {
_selectedWidget = const Sessions();
_selectedWidget = const Discounts();
} else if (widget.initialScreen == 1) {
_selectedWidget = const Products();
} else if (widget.initialScreen == 2) {
@ -45,7 +45,7 @@ class _MenuState extends State<Menu> {
body: _selectedWidget,
bottomNavigationBar: Navigation(
itemIcons: const [
Icons.settings,
Icons.percent,
Icons.list_alt_rounded,
Icons.shopping_cart,
Icons.wysiwyg
@ -62,15 +62,8 @@ class _MenuState extends State<Menu> {
var oldSelectedIndex = _selectedIndex;
_selectedIndex = index;
if (index == 0) {
_selectedWidget = const Sessions();
checkSessionExist().then((isLoggedIn) {
if (!isLoggedIn) {
_selectedIndex = oldSelectedIndex;
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => const Menu(initialScreen: 2)));
Navigator.pushNamed(context, '/login');
}
});
html.window.history.pushState(null, '', '/#/discounts');
_selectedWidget = const Discounts();
} else if (index == 1) {
html.window.history.pushState(null, '', '/#/products');
_selectedWidget = const Products();

View file

@ -70,7 +70,7 @@ class NewArrivalProducts extends StatelessWidget {
child: ProductCard(
title: 'Loading...',
imageUrl:
"https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp",
"https://telegra.ph/file/75f075e858198e4e7898a.png",
bgColor: const Color(0xFFFEFBF9),
press: () {},
),

View file

@ -70,7 +70,7 @@ class PopularProducts extends StatelessWidget {
child: ProductCard(
title: 'Loading...',
imageUrl:
"https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp",
"https://telegra.ph/file/75f075e858198e4e7898a.png",
bgColor: const Color(0xFFFEFBF9),
press: () {},
),

View file

@ -94,7 +94,8 @@ class _ProductBoxState extends State<ProductBox> {
child: Center(
child: Text("${widget.discount}% off",
style: const TextStyle(
color: Colors.white)))),
color: Colors.white,
fontSize: 11.0)))),
],
)
])

View file

@ -218,7 +218,7 @@ Widget productDetail(context, id) {
color: Colors.white),
child: ElevatedButton.icon(
onPressed: () {
addToCart(id);
addToCart(id, selectedSize);
final dynamic cartToolTip_ =
cartToolTipKey_.currentState;
cartToolTip_.ensureTooltipVisible();

View file

@ -169,7 +169,7 @@ class _TransactionBoxState extends State<TransactionBox> {
return const TransactionProductBox(
imageUrl:
'https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp',
'https://telegra.ph/file/75f075e858198e4e7898a.png',
title: 'Loading...',
quantity: 0,
);

View file

@ -1,14 +1,21 @@
import 'dart:convert';
import 'package:hive/hive.dart';
Future<void> addToCart(productId) async {
Future<void> addToCart(productId, size) async {
final box = Hive.box();
var cart = jsonDecode(box.get('cart', defaultValue: '[]'));
var filteredCart = cart.where((x) => x["product_id"] == productId).toList();
var selectedSize = [];
if (filteredCart.length == 0) {
cart.add({"product_id": productId, "quantity": 1});
selectedSize.add(size);
cart.add({"product_id": productId, "quantity": 1, "size": selectedSize});
} else {
selectedSize = filteredCart[0]["size"];
selectedSize.add(size);
filteredCart[0]["size"] = selectedSize;
filteredCart[0]["quantity"]++;
cart = cart.where((x) => x["product_id"] != productId).toList();
cart.add(filteredCart[0]);
@ -29,6 +36,7 @@ Future<void> removeFromCart(productId, bool batch) async {
if (filteredCart[0]["quantity"] == 0) {
cart = cart.where((x) => x["product_id"] != productId).toList();
} else {
filteredCart[0]["size"].removeLast();
cart = cart.where((x) => x["product_id"] != productId).toList();
cart.add(filteredCart[0]);
}
@ -37,6 +45,12 @@ Future<void> removeFromCart(productId, bool batch) async {
box.put('cart', jsonEncode(cart).toString());
}
Future<dynamic> clearCart() async {
final box = Hive.box();
box.put('cart', '[]');
}
Future<dynamic> viewCart() async {
final box = Hive.box();

View file

@ -62,13 +62,12 @@ class _NekoyaState extends State<Nekoya> {
'/products': (context) => const Menu(
initialScreen: 1,
),
'/discounts': (context) => const Menu(
initialScreen: 0,
),
'/cart': (context) => const Menu(
initialScreen: 3,
),
'/sessions': (context) => const NavigationAuth(
route: Menu(
initialScreen: 0,
)),
'/transactions': (context) => const NavigationAuth(
route: Menu(
initialScreen: 4,

View file

@ -66,8 +66,11 @@ class _CartState extends State<Cart> {
"https://nekoya.moe.team/img/${productData[0]['IMAGE']}",
title: productData[0]['TITLE'],
quantity: data[index]["quantity"],
size: data[index]["size"],
plus: () {
addToCart(data[index]["product_id"]);
var size = data[index]["size"];
addToCart(data[index]["product_id"],
size[size.length - 1]);
setState(() {
_viewCart = viewCart();
getTotal_ = getTotal();
@ -95,9 +98,10 @@ class _CartState extends State<Cart> {
return CartBox(
controller: true,
imageUrl:
'https://i.ibb.co/QJFLZC4/La-Darknesss-Portrait.webp',
'https://telegra.ph/file/75f075e858198e4e7898a.png',
title: 'Loading...',
quantity: 0,
size: const [],
plus: () {},
minus: () {},
remove: () {},
@ -111,8 +115,9 @@ class _CartState extends State<Cart> {
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
'assets/images/image_empty.webp'))),
image:
AssetImage('assets/images/cart_empty.webp'),
fit: BoxFit.contain)),
),
);
}

View file

@ -0,0 +1,93 @@
import 'package:flutter/material.dart';
import 'package:nekoya_app/api/api.dart';
import 'package:nekoya_app/components/product_box.dart';
import 'package:nekoya_app/components/product_detail.dart';
import 'package:nekoya_app/utils/utils.dart'
show kMobileBreakpoint, kTabletBreakpoint, kDesktopBreakPoint;
class Discounts extends StatefulWidget {
const Discounts({Key? key}) : super(key: key);
@override
State<Discounts> createState() => _DiscountsState();
}
class _DiscountsState extends State<Discounts> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xff1b1c1e),
appBar: AppBar(
title: const Text('Discounts'),
centerTitle: true,
backgroundColor: const Color(0xff212226),
automaticallyImplyLeading: false,
),
body: LayoutBuilder(builder: (context, dimension) {
int gridCount = 2;
double fontSize = 14.0;
if (dimension.maxWidth <= kMobileBreakpoint) {
gridCount = 2;
fontSize = 14.0;
} else if (dimension.maxWidth > kMobileBreakpoint &&
dimension.maxWidth <= kTabletBreakpoint) {
gridCount = 4;
fontSize = 15.0;
} else if (dimension.maxWidth > kTabletBreakpoint &&
dimension.maxWidth <= kDesktopBreakPoint) {
gridCount = 5;
fontSize = 10.0;
} else {
gridCount = 6;
fontSize = 10.0;
}
return FutureBuilder<dynamic>(
future: getProducts(),
builder: (context, snapshot) {
if (snapshot.hasData) {
List<dynamic> data = snapshot.data;
List<dynamic> currentData = [];
for (var product in data) {
if (product['DISCOUNT'] != 0) {
currentData.add(product);
}
}
return GridView.count(
crossAxisCount: gridCount,
children: List.generate(currentData.length, (index) {
return ProductBox(
imageUrl:
"https://nekoya.moe.team/img/${currentData[index]['IMAGE']}",
title: currentData[index]['TITLE'],
discount: currentData[index]['DISCOUNT'],
fontSize: fontSize,
callback: () {
showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
context: context,
builder: (context) =>
productDetail(context, currentData[index]['ID']),
);
},
);
}),
);
}
return const Center(
child: CircularProgressIndicator(
color: Color(0xff8B0000),
),
);
},
);
}),
);
}
}

View file

@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'package:nekoya_app/components/bannerimage.dart';
import 'package:nekoya_app/components/carousel.dart';
import 'package:nekoya_app/components/new_arrival_products.dart';
import 'package:nekoya_app/components/newsletter.dart';
import 'package:nekoya_app/components/popular_products.dart';
import 'package:nekoya_app/components/search_form.dart';
import 'package:nekoya_app/screens/about_us.dart';
@ -68,8 +67,7 @@ class Home extends StatelessWidget {
height: 15,
),
const Bannerimage(),
const PopularProducts(),
const Newsletter(),
const PopularProducts()
],
),
),

View file

@ -110,7 +110,7 @@ class _ProductsState extends State<Products> {
children: List.generate(currentData.length, (index) {
return ProductBox(
imageUrl:
"https://nekoya.moe.team/img/${data[index]['IMAGE']}",
"https://nekoya.moe.team/img/${currentData[index]['IMAGE']}",
title: currentData[index]['TITLE'],
discount: currentData[index]['DISCOUNT'],
fontSize: fontSize,

View file

@ -69,26 +69,26 @@ packages:
dependency: "direct main"
description:
name: cached_network_image
sha256: fd3d0dc1d451f9a252b32d95d3f0c3c487bc41a75eba2e6097cb0b9c71491b15
sha256: f98972704692ba679db144261172a8e20feb145636c617af0eb4022132a6797f
url: "https://pub.dev"
source: hosted
version: "3.2.3"
version: "3.3.0"
cached_network_image_platform_interface:
dependency: transitive
description:
name: cached_network_image_platform_interface
sha256: bb2b8403b4ccdc60ef5f25c70dead1f3d32d24b9d6117cfc087f496b178594a7
sha256: "56aa42a7a01e3c9db8456d9f3f999931f1e05535b5a424271e9a38cabf066613"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
version: "3.0.0"
cached_network_image_web:
dependency: transitive
description:
name: cached_network_image_web
sha256: b8eb814ebfcb4dea049680f8c1ffb2df399e4d03bf7a352c775e26fa06e02fa0
sha256: "759b9a9f8f6ccbb66c185df805fac107f05730b1dab9c64626d1008cca532257"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
version: "1.1.0"
carousel_slider:
dependency: "direct main"
description:
@ -222,14 +222,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_blurhash:
dependency: transitive
description:
name: flutter_blurhash
sha256: "05001537bd3fac7644fa6558b09ec8c0a3f2eba78c0765f88912882b1331a5c6"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
flutter_cache_manager:
dependency: transitive
description:
@ -444,10 +436,10 @@ packages:
dependency: transitive
description:
name: octo_image
sha256: "107f3ed1330006a3bea63615e81cf637433f5135a52466c7caa0e7152bca9143"
sha256: "45b40f99622f11901238e18d48f5f12ea36426d8eced9f4cbf58479c7aa2430d"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
version: "2.0.0"
package_config:
dependency: transitive
description:

View file

@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.1.0
version: 1.2.0
environment:
sdk: ">=3.1.0 < 4.0.0"
@ -28,7 +28,7 @@ environment:
# versions available, run `flutter pub outdated`.
dependencies:
animated_splash_screen: ^1.3.0
cached_network_image: ^3.2.3
cached_network_image: ^3.3.0
carousel_slider: ^4.2.1
collection: ^1.17.2
cupertino_icons: ^1.0.6