feat: add detail account screen
This commit is contained in:
parent
2ca7614650
commit
3ae244f905
|
|
@ -10,6 +10,7 @@ import 'package:agrilink_vocpro/features/home/detail_pages/potassium/view/potass
|
||||||
import 'package:agrilink_vocpro/features/home/detail_pages/soil_moisture/view/soil_moisture_screen.dart';
|
import 'package:agrilink_vocpro/features/home/detail_pages/soil_moisture/view/soil_moisture_screen.dart';
|
||||||
import 'package:agrilink_vocpro/features/home/detail_pages/soil_temperature/view/soil_temperature_screen.dart';
|
import 'package:agrilink_vocpro/features/home/detail_pages/soil_temperature/view/soil_temperature_screen.dart';
|
||||||
import 'package:agrilink_vocpro/features/home/detail_pages/temperature/view/temperature_screen.dart';
|
import 'package:agrilink_vocpro/features/home/detail_pages/temperature/view/temperature_screen.dart';
|
||||||
|
import 'package:agrilink_vocpro/features/setting/view/account_screen.dart';
|
||||||
import 'package:agrilink_vocpro/features/splash/view/splash_screen.dart';
|
import 'package:agrilink_vocpro/features/splash/view/splash_screen.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
@ -21,6 +22,7 @@ class AppRoute {
|
||||||
static const String home = '/home';
|
static const String home = '/home';
|
||||||
static const String profile = '/profile';
|
static const String profile = '/profile';
|
||||||
static const String setting = '/setting';
|
static const String setting = '/setting';
|
||||||
|
static const String account = '/dashboard/account';
|
||||||
static const String humidity = '/dashboard/humidity';
|
static const String humidity = '/dashboard/humidity';
|
||||||
static const String temperature = '/dashboard/temperature';
|
static const String temperature = '/dashboard/temperature';
|
||||||
static const String soilTemperature = '/dashboard/soil_temperature';
|
static const String soilTemperature = '/dashboard/soil_temperature';
|
||||||
|
|
@ -69,6 +71,11 @@ class AppRoute {
|
||||||
buildPhosphorusRoute(),
|
buildPhosphorusRoute(),
|
||||||
// potassium
|
// potassium
|
||||||
buildPotassiumRoute(),
|
buildPotassiumRoute(),
|
||||||
|
GoRoute(
|
||||||
|
path: 'account',
|
||||||
|
builder: (context, state) {
|
||||||
|
return AccountScreen();
|
||||||
|
})
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,13 @@ class SettingProvider extends ChangeNotifier {
|
||||||
|
|
||||||
String userFullName = '';
|
String userFullName = '';
|
||||||
String userEmail = '';
|
String userEmail = '';
|
||||||
|
String userName = '';
|
||||||
|
|
||||||
void _init() async {
|
void _init() async {
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
userFullName = prefs.getString('fullName') ?? 'unknown';
|
userFullName = prefs.getString('fullName') ?? 'unknown';
|
||||||
userEmail = prefs.getString('email') ?? 'unknown';
|
userEmail = prefs.getString('email') ?? 'unknown';
|
||||||
|
userName = prefs.getString('username') ?? 'unknown';
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
import 'package:agrilink_vocpro/core/constant/app_theme.dart';
|
||||||
|
import 'package:agrilink_vocpro/features/setting/provider/setting_provider.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class AccountScreen extends StatelessWidget {
|
||||||
|
const AccountScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text('Detail Account', style: AppTheme.labelMedium),
|
||||||
|
centerTitle: true,
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
scrolledUnderElevation: 0,
|
||||||
|
),
|
||||||
|
body: Consumer<SettingProvider>(builder: (context, provider, child) {
|
||||||
|
return ListView(
|
||||||
|
padding: EdgeInsets.all(16.r),
|
||||||
|
children: [
|
||||||
|
ListTile(
|
||||||
|
title: Text('Username', style: AppTheme.labelMedium),
|
||||||
|
trailing: Text(provider.userName, style: AppTheme.labelSmall),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: Text('Email', style: AppTheme.labelMedium),
|
||||||
|
trailing: Text(provider.userEmail, style: AppTheme.labelSmall),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
title: Text('Name', style: AppTheme.labelMedium),
|
||||||
|
trailing: Text(provider.userFullName, style: AppTheme.labelSmall),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -60,32 +60,34 @@ class SettingScreen extends StatelessWidget {
|
||||||
Icons.arrow_forward_ios,
|
Icons.arrow_forward_ios,
|
||||||
size: 16.r,
|
size: 16.r,
|
||||||
),
|
),
|
||||||
onTap: () {},
|
onTap: () {
|
||||||
),
|
context.go(AppRoute.account);
|
||||||
ListTile(
|
},
|
||||||
tileColor: Colors.white,
|
|
||||||
title: Text('Kebijakan & privasi',
|
|
||||||
style: AppTheme.labelSmall
|
|
||||||
.copyWith(color: Colors.black87)),
|
|
||||||
leading: const Icon(BootstrapIcons.shield_check),
|
|
||||||
trailing: Icon(
|
|
||||||
Icons.arrow_forward_ios,
|
|
||||||
size: 16.r,
|
|
||||||
),
|
|
||||||
onTap: () {},
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
tileColor: Colors.white,
|
|
||||||
title: Text('Syarat & ketentuan',
|
|
||||||
style: AppTheme.labelSmall
|
|
||||||
.copyWith(color: Colors.black87)),
|
|
||||||
leading: const Icon(BootstrapIcons.file_text),
|
|
||||||
trailing: Icon(
|
|
||||||
Icons.arrow_forward_ios,
|
|
||||||
size: 16.r,
|
|
||||||
),
|
|
||||||
onTap: () {},
|
|
||||||
),
|
),
|
||||||
|
// ListTile(
|
||||||
|
// tileColor: Colors.white,
|
||||||
|
// title: Text('Kebijakan & privasi',
|
||||||
|
// style: AppTheme.labelSmall
|
||||||
|
// .copyWith(color: Colors.black87)),
|
||||||
|
// leading: const Icon(BootstrapIcons.shield_check),
|
||||||
|
// trailing: Icon(
|
||||||
|
// Icons.arrow_forward_ios,
|
||||||
|
// size: 16.r,
|
||||||
|
// ),
|
||||||
|
// onTap: () {},
|
||||||
|
// ),
|
||||||
|
// ListTile(
|
||||||
|
// tileColor: Colors.white,
|
||||||
|
// title: Text('Syarat & ketentuan',
|
||||||
|
// style: AppTheme.labelSmall
|
||||||
|
// .copyWith(color: Colors.black87)),
|
||||||
|
// leading: const Icon(BootstrapIcons.file_text),
|
||||||
|
// trailing: Icon(
|
||||||
|
// Icons.arrow_forward_ios,
|
||||||
|
// size: 16.r,
|
||||||
|
// ),
|
||||||
|
// onTap: () {},
|
||||||
|
// ),
|
||||||
ListTile(
|
ListTile(
|
||||||
tileColor: Colors.white,
|
tileColor: Colors.white,
|
||||||
title: Text('Logout',
|
title: Text('Logout',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user