登录流程已全部重构
This commit is contained in:
25
lib/pages/profile/edit/data/state.dart
Normal file
25
lib/pages/profile/edit/data/state.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:food_health/api/dto/user_profile_dto.dart';
|
||||
|
||||
class SelectionState extends ChangeNotifier {
|
||||
UserProfileDto userProfile = UserProfileDto();
|
||||
|
||||
SelectionState(this.userProfile);
|
||||
|
||||
void update(void Function(UserProfileDto) updater) {
|
||||
updater(userProfile);
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
class SelectionProvider extends InheritedNotifier<SelectionState> {
|
||||
const SelectionProvider({
|
||||
super.key,
|
||||
required SelectionState super.notifier,
|
||||
required super.child,
|
||||
});
|
||||
|
||||
static SelectionState of(BuildContext context) {
|
||||
return context.dependOnInheritedWidgetOfExactType<SelectionProvider>()!.notifier!;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user