refactor: tidy up ui code
This commit is contained in:
parent
dcef0cf99d
commit
b797ac3f5e
|
|
@ -1,28 +1 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
Future<dynamic> showInfo(BuildContext context, String title, String content) {
|
|
||||||
return showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => AlertDialog(
|
|
||||||
content: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Text(title),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Text(
|
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
|
||||||
content,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
child: const Text('OK'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class ControlScreen extends StatelessWidget {
|
||||||
final provider = Provider.of<ControlProvider>(context, listen: true);
|
final provider = Provider.of<ControlProvider>(context, listen: true);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('Control', style: AppTheme.labelMedium),
|
title: Text('Kontrol', style: AppTheme.labelMedium),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
|
|
|
||||||
|
|
@ -26,22 +26,22 @@ class DashboardScreen extends StatelessWidget {
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(BootstrapIcons.house),
|
icon: Icon(BootstrapIcons.house),
|
||||||
activeIcon: Icon(BootstrapIcons.house_fill),
|
activeIcon: Icon(BootstrapIcons.house_fill),
|
||||||
label: 'Home',
|
label: 'Beranda',
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(BootstrapIcons.toggle_off),
|
icon: Icon(BootstrapIcons.toggle_off),
|
||||||
activeIcon: Icon(BootstrapIcons.toggle_on),
|
activeIcon: Icon(BootstrapIcons.toggle_on),
|
||||||
label: 'Control',
|
label: 'Kontrol',
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(BootstrapIcons.flower1),
|
icon: Icon(BootstrapIcons.flower1),
|
||||||
activeIcon: Icon(BootstrapIcons.flower1),
|
activeIcon: Icon(BootstrapIcons.flower1),
|
||||||
label: 'Plants',
|
label: 'Tanaman',
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(BootstrapIcons.gear),
|
icon: Icon(BootstrapIcons.gear),
|
||||||
activeIcon: Icon(BootstrapIcons.gear_fill),
|
activeIcon: Icon(BootstrapIcons.gear_fill),
|
||||||
label: 'Setting',
|
label: 'Pengaturan',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class ConductivityScreen extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Soil Condutivity',
|
'Konduktifitas Tanah',
|
||||||
style: AppTheme.labelMedium,
|
style: AppTheme.labelMedium,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
import 'package:agrilink_vocpro/core/constant/app_theme.dart';
|
import 'package:agrilink_vocpro/core/constant/app_theme.dart';
|
||||||
import 'package:agrilink_vocpro/core/state/result_state.dart';
|
import 'package:agrilink_vocpro/core/state/result_state.dart';
|
||||||
|
import 'package:agrilink_vocpro/core/widgets/error_data_state_widget.dart';
|
||||||
|
import 'package:agrilink_vocpro/core/widgets/no_data_state_widget.dart';
|
||||||
import 'package:agrilink_vocpro/features/home/detail_pages/humidity/provider/humidity_provider.dart';
|
import 'package:agrilink_vocpro/features/home/detail_pages/humidity/provider/humidity_provider.dart';
|
||||||
import 'package:agrilink_vocpro/features/home/provider/home_provider.dart';
|
import 'package:agrilink_vocpro/features/home/provider/home_provider.dart';
|
||||||
import 'package:agrilink_vocpro/features/home/widgets/graphic_widget.dart';
|
import 'package:agrilink_vocpro/features/home/widgets/graphic_widget.dart';
|
||||||
|
|
@ -94,7 +96,7 @@ class HumidityScreen extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Humidity',
|
'Kelembaban Udara',
|
||||||
style: AppTheme.labelMedium,
|
style: AppTheme.labelMedium,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
@ -145,39 +147,9 @@ class HumidityScreen extends StatelessWidget {
|
||||||
0),
|
0),
|
||||||
);
|
);
|
||||||
case ResultState.error:
|
case ResultState.error:
|
||||||
return Center(
|
return const ErrorDataStateWidget();
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
BootstrapIcons.exclamation_circle,
|
|
||||||
color: Colors.grey.shade400,
|
|
||||||
),
|
|
||||||
SizedBox(height: 8.h),
|
|
||||||
Text(
|
|
||||||
'Terjadi Kesalahan',
|
|
||||||
style: AppTheme.labelSmall,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
case ResultState.noData:
|
case ResultState.noData:
|
||||||
return Center(
|
return const NoDataStateWidget();
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Icon(
|
|
||||||
BootstrapIcons.database_fill_x,
|
|
||||||
color: Colors.grey.shade400,
|
|
||||||
),
|
|
||||||
SizedBox(height: 8.h),
|
|
||||||
Text(
|
|
||||||
'Tidak Ada Data',
|
|
||||||
style: AppTheme.labelSmall,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
case ResultState.initial:
|
case ResultState.initial:
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class NitrogenScreen extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Soil Nitrogen',
|
'Nitrogen Tanah',
|
||||||
style: AppTheme.labelMedium,
|
style: AppTheme.labelMedium,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ class PhScreen extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Soil Acidity',
|
'pH Tanah',
|
||||||
style: AppTheme.labelMedium,
|
style: AppTheme.labelMedium,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class PhosphorusScreen extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Soil Phosphorus',
|
'Fosfor Tanah',
|
||||||
style: AppTheme.labelMedium,
|
style: AppTheme.labelMedium,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class PotassiumScreen extends StatelessWidget {
|
||||||
length: 2,
|
length: 2,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('Soil Potassium', style: AppTheme.labelMedium),
|
title: Text('Soil Potassium (Kalium)', style: AppTheme.labelMedium),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
|
|
@ -95,7 +95,7 @@ class PotassiumScreen extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Soil Potassium',
|
'Kalium Tanah',
|
||||||
style: AppTheme.labelMedium,
|
style: AppTheme.labelMedium,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ class SoilMoistureScreen extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Soil Moisture',
|
'Kelembaban Tanah',
|
||||||
style: AppTheme.labelMedium,
|
style: AppTheme.labelMedium,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
@ -151,7 +151,6 @@ class SoilMoistureScreen extends StatelessWidget {
|
||||||
child: Consumer<SoilMoistureProvider>(
|
child: Consumer<SoilMoistureProvider>(
|
||||||
builder: (context, provider, child) {
|
builder: (context, provider, child) {
|
||||||
final dataState = provider.dataState;
|
final dataState = provider.dataState;
|
||||||
|
|
||||||
switch (dataState) {
|
switch (dataState) {
|
||||||
case ResultState.loading:
|
case ResultState.loading:
|
||||||
return const Center(child: CupertinoActivityIndicator());
|
return const Center(child: CupertinoActivityIndicator());
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import 'package:provider/provider.dart';
|
||||||
import 'package:agrilink_vocpro/core/constant/app_constant.dart';
|
import 'package:agrilink_vocpro/core/constant/app_constant.dart';
|
||||||
import 'package:agrilink_vocpro/core/constant/app_theme.dart';
|
import 'package:agrilink_vocpro/core/constant/app_theme.dart';
|
||||||
import 'package:agrilink_vocpro/core/state/result_state.dart';
|
import 'package:agrilink_vocpro/core/state/result_state.dart';
|
||||||
import 'package:agrilink_vocpro/core/widgets/show_info.dart';
|
|
||||||
import 'package:agrilink_vocpro/features/home/detail_pages/soil_temperature/provider/soil_temp_provider.dart';
|
import 'package:agrilink_vocpro/features/home/detail_pages/soil_temperature/provider/soil_temp_provider.dart';
|
||||||
import 'package:agrilink_vocpro/features/home/widgets/graphic_widget.dart';
|
import 'package:agrilink_vocpro/features/home/widgets/graphic_widget.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
|
@ -172,7 +171,7 @@ class SoilTemperatureScreen extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Soil Temperature',
|
'Suhu Tanah',
|
||||||
style: AppTheme.labelMedium,
|
style: AppTheme.labelMedium,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
@ -180,7 +179,7 @@ class SoilTemperatureScreen extends StatelessWidget {
|
||||||
iconSize: 20.r,
|
iconSize: 20.r,
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showInfo(context, 'Soil Temperature', AppConstant.soilTempInfo);
|
showInfo(context, 'Suhu Tanah', AppConstant.soilTempInfo);
|
||||||
},
|
},
|
||||||
icon: const Icon(BootstrapIcons.info_circle),
|
icon: const Icon(BootstrapIcons.info_circle),
|
||||||
),
|
),
|
||||||
|
|
@ -240,3 +239,30 @@ class SoilTemperatureScreen extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<dynamic> showInfo(BuildContext context, String title, String content) {
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(title),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
content,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: const Text('OK'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ class TemperatureScreen extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Temperature',
|
'Suhu Ruangan',
|
||||||
style: AppTheme.labelMedium,
|
style: AppTheme.labelMedium,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@ class PlantsScreen extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.eco_rounded, size: 100.r, color: AppColor.secondary),
|
Icon(Icons.eco_rounded, size: 100.r, color: AppColor.secondary),
|
||||||
Text('Coming Soon', style: AppTheme.titleLarge),
|
Text('Segera Hadir', style: AppTheme.titleLarge),
|
||||||
SizedBox(height: 8.h),
|
SizedBox(height: 8.h),
|
||||||
Text(
|
Text(
|
||||||
'This featureis under development',
|
'Fitur ini sedang dalam tahap pengembangan',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: AppTheme.labelSmall,
|
style: AppTheme.labelSmall,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ class AccountScreen extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('Detail Account', style: AppTheme.labelMedium),
|
title: Text('Detail Akun', style: AppTheme.labelMedium),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class SettingScreen extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text('Setting', style: AppTheme.labelMedium),
|
title: Text('Pengaturan', style: AppTheme.labelMedium),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
|
|
@ -52,7 +52,7 @@ class SettingScreen extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
tileColor: Colors.white,
|
tileColor: Colors.white,
|
||||||
title: Text('Account',
|
title: Text('Akun',
|
||||||
style: AppTheme.labelSmall
|
style: AppTheme.labelSmall
|
||||||
.copyWith(color: Colors.black87)),
|
.copyWith(color: Colors.black87)),
|
||||||
leading: const Icon(BootstrapIcons.person),
|
leading: const Icon(BootstrapIcons.person),
|
||||||
|
|
@ -90,7 +90,7 @@ class SettingScreen extends StatelessWidget {
|
||||||
// ),
|
// ),
|
||||||
ListTile(
|
ListTile(
|
||||||
tileColor: Colors.white,
|
tileColor: Colors.white,
|
||||||
title: Text('Logout',
|
title: Text('Keluar',
|
||||||
style: AppTheme.labelSmall.copyWith(color: Colors.red)),
|
style: AppTheme.labelSmall.copyWith(color: Colors.red)),
|
||||||
leading: const Icon(
|
leading: const Icon(
|
||||||
BootstrapIcons.box_arrow_right,
|
BootstrapIcons.box_arrow_right,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user