201 lines
7.3 KiB
Dart
201 lines
7.3 KiB
Dart
// ignore_for_file: use_build_context_synchronously
|
|
import 'dart:math' as math;
|
|
|
|
import 'package:custom_refresh_indicator/custom_refresh_indicator.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:gap/gap.dart';
|
|
import 'package:iconsax_flutter/iconsax_flutter.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/features/home/presentation/components/about_comp.dart';
|
|
import 'package:rijig_mobile/features/home/presentation/components/article_list.dart';
|
|
import 'package:rijig_mobile/globaldata/about/about_vmod.dart';
|
|
import 'package:rijig_mobile/globaldata/article/article_vmod.dart';
|
|
import 'package:rijig_mobile/widget/buttoncard.dart';
|
|
import 'package:rijig_mobile/widget/card_withicon.dart';
|
|
import 'package:rijig_mobile/widget/formfiled.dart';
|
|
import 'package:rijig_mobile/widget/showmodal.dart';
|
|
|
|
class HomeScreen extends StatefulWidget {
|
|
const HomeScreen({super.key});
|
|
|
|
@override
|
|
State<HomeScreen> createState() => _HomeScreenState();
|
|
}
|
|
|
|
class _HomeScreenState extends State<HomeScreen> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: whiteColor,
|
|
body: CustomMaterialIndicator(
|
|
onRefresh: () async {
|
|
await Provider.of<AboutViewModel>(
|
|
context,
|
|
listen: false,
|
|
).getAboutList();
|
|
await Provider.of<ArticleViewModel>(
|
|
context,
|
|
listen: false,
|
|
).loadArticles();
|
|
},
|
|
backgroundColor: whiteColor,
|
|
indicatorBuilder: (context, controller) {
|
|
return Padding(
|
|
padding: const EdgeInsets.all(6.0),
|
|
child: CircularProgressIndicator(
|
|
color: primaryColor,
|
|
value:
|
|
controller.state.isLoading
|
|
? null
|
|
: math.min(controller.value, 1.0),
|
|
),
|
|
);
|
|
},
|
|
child: SafeArea(
|
|
child: ListView(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text("Rijig", style: Tulisan.heading(color: primaryColor)),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
IconButton(
|
|
// onPressed: () => router.push('/trashview'),
|
|
onPressed: () => router.push('/notifikasi'),
|
|
icon: Icon(
|
|
Iconsax.notification_copy,
|
|
color: primaryColor,
|
|
),
|
|
),
|
|
IconButton(
|
|
onPressed: () {
|
|
debugPrint('message icon tapped');
|
|
// router.push('/cmapview');
|
|
router.push('/chatlist');
|
|
},
|
|
icon: Icon(Iconsax.message_copy, color: primaryColor),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
Gap(20),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
CardWithIcon(
|
|
icon: Iconsax.trash,
|
|
text: 'Sampah',
|
|
number: '245 kg',
|
|
onTap: () {
|
|
router.push('/dataperforma');
|
|
},
|
|
),
|
|
CardWithIcon(
|
|
icon: Iconsax.timer,
|
|
text: 'Process',
|
|
number: '1',
|
|
onTap: () {
|
|
CustomModalDialog.showWidget(
|
|
customWidget: FormFieldOne(
|
|
// controllers: cPhoneController,
|
|
hintText: 'Masukkan nomor whatsapp anda!',
|
|
placeholder: "cth.62..",
|
|
isRequired: true,
|
|
textInputAction: TextInputAction.done,
|
|
keyboardType: TextInputType.phone,
|
|
onTap: () {},
|
|
onChanged: (value) {},
|
|
fontSize: 14,
|
|
fontSizeField: 16,
|
|
onFieldSubmitted: (value) {},
|
|
readOnly: false,
|
|
enabled: true,
|
|
),
|
|
context: context,
|
|
// variant: ModalVariant.textVersion,
|
|
// title: 'Belum Tersedia',
|
|
// content: 'Maaf, fitur ini belum tersedia',
|
|
buttonCount: 2,
|
|
button1: CardButtonOne(
|
|
textButton: "oke, deh",
|
|
onTap: () {},
|
|
fontSized: 14,
|
|
colorText: whiteColor,
|
|
color: primaryColor,
|
|
borderRadius: 10,
|
|
horizontal: double.infinity,
|
|
vertical: 50,
|
|
loadingTrue: false,
|
|
usingRow: false,
|
|
),
|
|
button2: CardButtonOne(
|
|
textButton: "Batal",
|
|
onTap: () => router.pop(),
|
|
fontSized: 14,
|
|
colorText: primaryColor,
|
|
color: Colors.transparent,
|
|
borderRadius: 10,
|
|
horizontal: double.infinity,
|
|
vertical: 50,
|
|
loadingTrue: false,
|
|
usingRow: false,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
Gap(20),
|
|
Column(
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"Important!",
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.black,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Gap(15),
|
|
AboutComponent(),
|
|
],
|
|
),
|
|
Gap(20),
|
|
Column(
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"Artikel",
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.black,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Gap(15),
|
|
ArticleScreen(),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|