feat: add UI for pickup
This commit is contained in:
parent
e0060e244d
commit
63ba97382b
|
@ -55,5 +55,20 @@ final router = GoRouter(
|
||||||
return ArticleDetailScreen(data: data);
|
return ArticleDetailScreen(data: data);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
|
GoRoute(
|
||||||
|
path: '/pickupmethod',
|
||||||
|
builder: (context, state) {
|
||||||
|
dynamic data = state.extra;
|
||||||
|
return PickupScreen(data: data);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
GoRoute(
|
||||||
|
path: '/pilihpengepul',
|
||||||
|
builder: (context, state) {
|
||||||
|
return SelectCollectorScreen();
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
|
@ -13,3 +13,5 @@ export 'package:rijig_mobile/features/launch/screen/onboardingpage_screen.dart';
|
||||||
export 'package:rijig_mobile/features/launch/screen/splash_screen.dart';
|
export 'package:rijig_mobile/features/launch/screen/splash_screen.dart';
|
||||||
export 'package:rijig_mobile/features/home/presentation/components/about_detail_comp.dart';
|
export 'package:rijig_mobile/features/home/presentation/components/about_detail_comp.dart';
|
||||||
export 'package:rijig_mobile/features/home/presentation/components/article_content.dart';
|
export 'package:rijig_mobile/features/home/presentation/components/article_content.dart';
|
||||||
|
export 'package:rijig_mobile/features/pickup/presentation/screen/pickup_screen.dart';
|
||||||
|
export 'package:rijig_mobile/features/pickup/presentation/screen/selectcollector_screen.dart';
|
||||||
|
|
|
@ -6,6 +6,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:gap/gap.dart';
|
import 'package:gap/gap.dart';
|
||||||
import 'package:iconsax_flutter/iconsax_flutter.dart';
|
import 'package:iconsax_flutter/iconsax_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:rijig_mobile/core/router.dart';
|
||||||
import 'package:rijig_mobile/core/utils/guide.dart';
|
import 'package:rijig_mobile/core/utils/guide.dart';
|
||||||
import 'package:rijig_mobile/features/cart/model/cartitem_model.dart';
|
import 'package:rijig_mobile/features/cart/model/cartitem_model.dart';
|
||||||
import 'package:rijig_mobile/features/cart/presentation/viewmodel/cartitem_vmod.dart';
|
import 'package:rijig_mobile/features/cart/presentation/viewmodel/cartitem_vmod.dart';
|
||||||
|
@ -435,20 +436,23 @@ class _CartScreenState extends State<CartScreen> with WidgetsBindingObserver {
|
||||||
borderRadius: 9,
|
borderRadius: 9,
|
||||||
horizontal: double.infinity,
|
horizontal: double.infinity,
|
||||||
vertical: 50,
|
vertical: 50,
|
||||||
onTap: () async {
|
// onTap: () async {
|
||||||
final vmod = Provider.of<CartViewModel>(
|
// final vmod = Provider.of<CartViewModel>(
|
||||||
context,
|
// context,
|
||||||
listen: false,
|
// listen: false,
|
||||||
);
|
// );
|
||||||
await vmod.flushCartToServer();
|
// await vmod.flushCartToServer();
|
||||||
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
// ScaffoldMessenger.of(context).showSnackBar(
|
||||||
const SnackBar(
|
// const SnackBar(
|
||||||
content: Text(
|
// content: Text(
|
||||||
"Keranjang berhasil dikirim ke server!",
|
// "Keranjang berhasil dikirim ke server!",
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
|
// },
|
||||||
|
onTap: () {
|
||||||
|
router.push("/pickupmethod", extra: '');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:gap/gap.dart';
|
||||||
|
import 'package:rijig_mobile/core/router.dart';
|
||||||
|
import 'package:rijig_mobile/core/utils/guide.dart';
|
||||||
|
import 'package:rijig_mobile/widget/appbar.dart';
|
||||||
|
import 'package:rijig_mobile/widget/buttoncard.dart';
|
||||||
|
|
||||||
|
class PickupScreen extends StatefulWidget {
|
||||||
|
final dynamic data;
|
||||||
|
const PickupScreen({super.key, required this.data});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PickupScreen> createState() => _PickupScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PickupScreenState extends State<PickupScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: CustomAppBar(judul: "Request Method"),
|
||||||
|
body: SafeArea(
|
||||||
|
child: Padding(
|
||||||
|
padding: PaddingCustom().paddingHorizontal(20),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
CardButtonOne(
|
||||||
|
textButton: "otomatis",
|
||||||
|
fontSized: 16.sp,
|
||||||
|
color: primaryColor,
|
||||||
|
colorText: whiteColor,
|
||||||
|
borderRadius: 9,
|
||||||
|
horizontal: double.infinity,
|
||||||
|
vertical: 50,
|
||||||
|
onTap: () {
|
||||||
|
router.go('/navigasi', extra: '/activity');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Gap(30),
|
||||||
|
CardButtonOne(
|
||||||
|
textButton: "manual pilih driver",
|
||||||
|
fontSized: 16.sp,
|
||||||
|
color: primaryColor,
|
||||||
|
colorText: whiteColor,
|
||||||
|
borderRadius: 9,
|
||||||
|
horizontal: double.infinity,
|
||||||
|
vertical: 50,
|
||||||
|
onTap: () {
|
||||||
|
router.push('/pilihpengepul');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,117 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'dart:math';
|
||||||
|
import 'package:rijig_mobile/core/utils/guide.dart';
|
||||||
|
import 'package:rijig_mobile/widget/appbar.dart';
|
||||||
|
|
||||||
|
class Collector {
|
||||||
|
final String name;
|
||||||
|
final String address;
|
||||||
|
final double rating;
|
||||||
|
|
||||||
|
Collector({required this.name, required this.address, required this.rating});
|
||||||
|
}
|
||||||
|
|
||||||
|
class SelectCollectorScreen extends StatefulWidget {
|
||||||
|
const SelectCollectorScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SelectCollectorScreen> createState() => _SelectCollectorScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SelectCollectorScreenState extends State<SelectCollectorScreen> {
|
||||||
|
final List<Collector> collectors = List.generate(6, (index) {
|
||||||
|
final names = [
|
||||||
|
"Dimas Aditya",
|
||||||
|
"Siti Nurhaliza",
|
||||||
|
"Rizky Hidayat",
|
||||||
|
"Indah Lestari",
|
||||||
|
"Ahmad Fauzi",
|
||||||
|
"Mega Putri",
|
||||||
|
];
|
||||||
|
final addresses = [
|
||||||
|
"Jl. Merdeka No. ${index + 1}, Jakarta",
|
||||||
|
"Jl. Kebangsaan No. ${index + 2}, Bandung",
|
||||||
|
"Jl. Kartini No. ${index + 3}, Surabaya",
|
||||||
|
"Jl. Pancasila No. ${index + 4}, Yogyakarta",
|
||||||
|
"Jl. Garuda No. ${index + 5}, Semarang",
|
||||||
|
"Jl. Bhayangkara No. ${index + 6}, Medan",
|
||||||
|
];
|
||||||
|
final random = Random();
|
||||||
|
return Collector(
|
||||||
|
name: names[index % names.length],
|
||||||
|
address: addresses[index % addresses.length],
|
||||||
|
rating: (random.nextDouble() * 2) + 3,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: whiteColor,
|
||||||
|
appBar: CustomAppBar(judul: "Pilih Pengepul"),
|
||||||
|
body: SafeArea(
|
||||||
|
child: Padding(
|
||||||
|
padding: PaddingCustom().paddingHorizontalVertical(20, 10),
|
||||||
|
child: ListView.separated(
|
||||||
|
itemCount: collectors.length,
|
||||||
|
separatorBuilder: (_, __) => GapCustom().gapValue(10, true),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final collector = collectors[index];
|
||||||
|
return Card(
|
||||||
|
shadowColor: Colors.transparent,
|
||||||
|
color: whiteColor,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
side: BorderSide(width: 1, color: greyColor),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: PaddingCustom().paddingAll(16),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
CircleAvatar(
|
||||||
|
radius: 28,
|
||||||
|
backgroundColor: greyAbsolutColor,
|
||||||
|
child: Icon(Icons.person, color: whiteColor, size: 28),
|
||||||
|
),
|
||||||
|
GapCustom().gapValue(16, false),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
collector.name,
|
||||||
|
style: Tulisan.subheading(fontsize: 16),
|
||||||
|
),
|
||||||
|
GapCustom().gapValue(5, true),
|
||||||
|
Text(
|
||||||
|
collector.address,
|
||||||
|
style: TextStyle(
|
||||||
|
color: greyAbsolutColor,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
GapCustom().gapValue(5, true),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.star, color: Colors.amber, size: 18),
|
||||||
|
GapCustom().gapValue(5, false),
|
||||||
|
Text(
|
||||||
|
collector.rating.toStringAsFixed(1),
|
||||||
|
style: Tulisan.customText(fontsize: 12),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue