Skip to content

Commit

Permalink
Fix some bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bagussubagja committed Dec 2, 2022
1 parent 0c35a3f commit 29c3acc
Show file tree
Hide file tree
Showing 14 changed files with 366 additions and 255 deletions.
14 changes: 14 additions & 0 deletions lib/core/authentication/user_notifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,17 @@ class UserDiscountClass extends ChangeNotifier {
notifyListeners();
}
}

class UserUpdateSelfDataClass extends ChangeNotifier {
Future<void> updateSelfData(
UserModel body, String idUser, BuildContext context) async {
notifyListeners();
http.Response response = (await updateSelfDataUser(body, idUser, context))!;
if (response.statusCode == 204) {
debugPrint('Update Berhasil');
} else {
debugPrint(response.statusCode.toString());
}
notifyListeners();
}
}
4 changes: 2 additions & 2 deletions lib/models/user_model/user_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class UserModel {
"age": age,
"weight": weight,
"height": height,
"dailyActivity": dailyActivity,
"dailyCalories": dailyCalories
"daily_activity": dailyActivity,
"daily_calories": dailyCalories
};
}
3 changes: 3 additions & 0 deletions lib/providers/providers_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ class ProviderList {
ChangeNotifierProvider(
create: (_) => UserUpdateAddressClass(),
),
ChangeNotifierProvider(
create: (_) => UserUpdateSelfDataClass(),
),
ChangeNotifierProvider(
create: (_) => UserTopUpClass(),
),
Expand Down
1 change: 0 additions & 1 deletion lib/screens/authentication/biodata_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class _BiodataScreenState extends State<BiodataScreen> {
"Cukup Padat",
"Sangat Padat"
];
List<double> _activityValues = [1.2, 1.35, 1.5, 1.7, 1.9];

String? _selectedActivityValue = 'Normal';

Expand Down
8 changes: 4 additions & 4 deletions lib/screens/home/body_page_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@ class _BodyPageScreenState extends State<BodyPageScreen> {
icon: _currentIndex == 0
? const Icon(Icons.home)
: const Icon(Icons.home_outlined),
title: const Text("Home"),
title: const Text("Laman Utama"),
selectedColor: greenColor,
unselectedColor: blackColor),
SalomonBottomBarItem(
icon: _currentIndex == 1
? const Icon(Icons.favorite)
: const Icon(Icons.favorite_border),
title: const Text("Favorites"),
title: const Text("Favorite"),
selectedColor: greenColor,
unselectedColor: blackColor),
SalomonBottomBarItem(
icon: _currentIndex == 2
? const Icon(Icons.shopping_cart)
: const Icon(Icons.shopping_cart_outlined),
title: const Text("Wishlist"),
title: const Text("Keranjang"),
selectedColor: greenColor,
unselectedColor: blackColor),
SalomonBottomBarItem(
icon: _currentIndex == 3
? const Icon(Icons.settings)
: const Icon(Icons.settings_outlined),
title: const Text("Settings"),
title: const Text("Pengaturan"),
selectedColor: greenColor,
unselectedColor: blackColor),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/home/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class _HomePageState extends State<HomePage> {
width: double.infinity,
decoration: BoxDecoration(
borderRadius: const BorderRadius.vertical(
top: Radius.circular(10),
top: Radius.circular(25),
),
color: bgColor),
child: Padding(
Expand Down
15 changes: 5 additions & 10 deletions lib/screens/home/profile_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:healthy_buddy_mobile_app/routes/routes.dart';
import 'package:healthy_buddy_mobile_app/screens/widgets/custom_textfield.dart';
import 'package:healthy_buddy_mobile_app/screens/widgets/margin_height.dart';
import 'package:healthy_buddy_mobile_app/shared/theme.dart';
import 'package:indonesia/indonesia.dart';
import 'package:provider/provider.dart';
import 'package:sizer/sizer.dart';

Expand All @@ -19,19 +20,13 @@ class ProfileScreen extends StatefulWidget {

class _ProfileScreenState extends State<ProfileScreen> {
@override
void initState() {
// TODO: implement initState
super.initState();
Widget build(BuildContext context) {
final user = Provider.of<UserClass>(context, listen: false);
ReadCache.getString(key: 'cache').then((value) {
setState(() {
user.getUser(context: context, idUser: value);
});
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: greenColor,
appBar: AppBar(
Expand Down Expand Up @@ -98,7 +93,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
),
MarginHeight(height: 0.5.h),
Text(
'${user.users?[0].email}',
"Saldo : ${rupiah(user.users?[0].balance)}",
style: regularStyle.copyWith(
color: whiteColor,
fontSize: 13.sp,
Expand Down Expand Up @@ -131,10 +126,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
CustomTextField(
readOnly: true,
prefixIcon: Icon(
Icons.person_outline_rounded,
Icons.email_outlined,
color: greenColor,
),
hintText: '${user.users?[0].name}',
hintText: '${user.users?[0].email}',
),
MarginHeight(height: 2.h),
CustomTextField(
Expand Down
Loading

0 comments on commit 29c3acc

Please sign in to comment.