tab navigation
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import 'package:auth/src/device_sign_up/link_watch/create_profile_screen.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
// import 'package:sf_app_platform/payments/view/screens/core/dashboard_screen.dart';
|
||||
// import 'package:sf_app_platform/payments/view/screens/link_watch/create_profile_screen.dart';
|
||||
|
||||
class AddKidScreen extends StatelessWidget {
|
||||
const AddKidScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
|
||||
@@ -5,9 +5,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class CreateProfileScreen extends ConsumerWidget {
|
||||
CreateProfileScreen({super.key});
|
||||
const CreateProfileScreen({super.key});
|
||||
|
||||
int currentStep = 0;
|
||||
final int currentStep = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
// import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
class LoadingGoogleScreen extends StatelessWidget {
|
||||
const LoadingGoogleScreen({super.key});
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
import 'package:auth/src/login/presentation/loading_google_screen.dart';
|
||||
import 'package:auth/src/recover_password/presentation/restore_password_screen.dart';
|
||||
import 'package:auth/src/sign_up/signup_screen.dart';
|
||||
import 'package:dashboard_shell/dashboard_shell.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
// import 'package:sf_app_platform/payments/view/screens/core/dashboard_screen.dart';
|
||||
// import 'package:sf_app_platform/payments/view/screens/loading_google_screen.dart';
|
||||
// import 'package:sf_app_platform/payments/view/screens/restore_password/restore_password_screen.dart';
|
||||
// import 'package:sf_app_platform/payments/view/screens/signup/signup_screen.dart';
|
||||
|
||||
class LoginScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
@@ -66,8 +60,7 @@ class LoginScreen extends ConsumerWidget {
|
||||
child: Text("¿Has olvidado la contraseña?"),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () =>
|
||||
navigationContract.pushTo('/dashboard_shell'),
|
||||
onPressed: () => navigationContract.pushTo('/main/home'),
|
||||
child: Text("Iniciar sesión"),
|
||||
),
|
||||
Stack(children: [Divider(), Text("o continúa con")]),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:auth/src/login/presentation/login_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
@@ -3,11 +3,6 @@ import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
|
||||
// import 'package:sf_app_platform/payments/view/screens/link_phone_screen.dart';
|
||||
// import 'package:sf_app_platform/payments/view/screens/signup/signup_screen.dart';
|
||||
|
||||
// import '../../../../../apps/mobile_app/lib/payments/view/screens/core/dashboard_screen.dart';
|
||||
|
||||
class WelcomeScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
|
||||
|
||||
@@ -1,24 +1,15 @@
|
||||
import 'package:auth/src/recover_password/presentation/new_password_screen.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
// import 'package:sf_app_platform/payments/domain/ports/theme_port.dart';
|
||||
// import 'package:sf_app_platform/payments/view/screens/restore_password/new_password_screen.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class EmailSentScreen extends StatefulWidget {
|
||||
class EmailSentScreen extends ConsumerWidget {
|
||||
final String email;
|
||||
|
||||
const EmailSentScreen({super.key, required this.email});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => EmailSentScreenState();
|
||||
}
|
||||
|
||||
class EmailSentScreenState extends State<EmailSentScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = context.read<ThemePort>();
|
||||
Widget build(BuildContext contex, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
@@ -65,12 +56,12 @@ class EmailSentScreenState extends State<EmailSentScreen> {
|
||||
Expanded(
|
||||
child: FilledButton(
|
||||
onPressed: () => {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => NewPasswordScreen(),
|
||||
),
|
||||
),
|
||||
// Navigator.push(
|
||||
// context,
|
||||
// MaterialPageRoute(
|
||||
// builder: (_) => NewPasswordScreen(),
|
||||
// ),
|
||||
// ),
|
||||
},
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStatePropertyAll<Color>(
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
// import '../../../domain/ports/theme_port.dart';
|
||||
|
||||
class NewPasswordScreen extends StatefulWidget {
|
||||
class NewPasswordScreen extends ConsumerStatefulWidget {
|
||||
const NewPasswordScreen({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => NewPasswordScreenState();
|
||||
ConsumerState<NewPasswordScreen> createState() => NewPasswordScreenState();
|
||||
}
|
||||
|
||||
class NewPasswordScreenState extends State<NewPasswordScreen> {
|
||||
class NewPasswordScreenState extends ConsumerState<NewPasswordScreen> {
|
||||
bool passwordVisible = false;
|
||||
bool equalPasswords = false;
|
||||
String password = "";
|
||||
@@ -39,7 +36,7 @@ class NewPasswordScreenState extends State<NewPasswordScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = context.read<ThemePort>();
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
|
||||
@@ -2,13 +2,8 @@ import 'package:auth/src/recover_password/presentation/email_sent_screen.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
// import 'package:sf_app_platform/payments/domain/ports/theme_port.dart';
|
||||
// import 'package:sf_app_platform/payments/view/screens/restore_password/email_sent_screen.dart';
|
||||
|
||||
class RestorePasswordScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
|
||||
@@ -16,7 +11,6 @@ class RestorePasswordScreen extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
// ThemePort theme = context.read<ThemePort>();
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
return Scaffold(
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import 'package:auth/src/device_sign_up/add_kid_screen.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
// import 'package:sf_app_platform/payments/view/screens/add_kid_screen.dart';
|
||||
// import 'package:sf_app_platform/payments/view/screens/core/dashboard_screen.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
// import '../../../../../apps/mobile_app/lib/payments/domain/ports/theme_port.dart';
|
||||
class AccountCreatedScreen extends ConsumerWidget {
|
||||
const AccountCreatedScreen({super.key});
|
||||
|
||||
class AccountCreatedScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ThemePort theme = context.read<ThemePort>();
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final email = "usuario@example.com";
|
||||
final fullName = "Carlos Pérez Cruz";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SignupAddressScreen extends StatelessWidget{
|
||||
class SignupAddressScreen extends StatelessWidget {
|
||||
const SignupAddressScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -8,10 +9,25 @@ class SignupAddressScreen extends StatelessWidget{
|
||||
spacing: 30,
|
||||
children: [
|
||||
Text("Domicilio"),
|
||||
Text("Tu dirección", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30)),
|
||||
Text("Tu dirección nos ayuda a verificar y mantener la seguridad de tu cuenta"),
|
||||
TextField(decoration: InputDecoration(hintText: "Dirección completa", border: OutlineInputBorder())),
|
||||
TextField(decoration: InputDecoration(hintText: "Ciudad", border: OutlineInputBorder())),
|
||||
Text(
|
||||
"Tu dirección",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
|
||||
),
|
||||
Text(
|
||||
"Tu dirección nos ayuda a verificar y mantener la seguridad de tu cuenta",
|
||||
),
|
||||
TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Dirección completa",
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Ciudad",
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
DropdownMenu(
|
||||
dropdownMenuEntries: List<DropdownMenuEntry>.generate(3, (int index) {
|
||||
return DropdownMenuEntry(value: "España", label: "España");
|
||||
@@ -19,9 +35,13 @@ class SignupAddressScreen extends StatelessWidget{
|
||||
hintText: "País",
|
||||
width: double.infinity,
|
||||
),
|
||||
TextField(decoration: InputDecoration(hintText: "Nacionalidad", border: OutlineInputBorder()))
|
||||
TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: "Nacionalidad",
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import 'package:auth/src/sign_up/account_created_screen.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
// import 'package:sf_app_platform/payments/view/screens/account_created_screen.dart';
|
||||
import 'package:auth/src/sign_up/signup_address_screen.dart';
|
||||
import 'package:auth/src/sign_up/signup_personal_screen.dart';
|
||||
import 'package:auth/src/sign_up/signup_user_screen.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
// import '../../../../../apps/mobile_app/lib/payments/domain/ports/theme_port.dart';
|
||||
|
||||
class SignupScreen extends ConsumerWidget {
|
||||
SignupScreen({super.key});
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export 'src/presentation/dashboard_screen.dart';
|
||||
export 'src/presentation/main_shell_screen.dart';
|
||||
export 'dashboard_builder.dart';
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:home/home.dart';
|
||||
import 'package:notifications/notifications.dart';
|
||||
import 'package:profile/profile.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class DashboardScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
|
||||
DashboardScreen({super.key, required this.navigationContract});
|
||||
|
||||
int currentPageIndex = 3;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final bodies = [
|
||||
HomeScreen(),
|
||||
ActivityScreen(),
|
||||
AlertScreen(),
|
||||
ProfileScreen(),
|
||||
];
|
||||
|
||||
return Scaffold(
|
||||
bottomNavigationBar: NavigationBar(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
onDestinationSelected: (int index) {
|
||||
// setState(() {
|
||||
// currentPageIndex = index;
|
||||
// });
|
||||
},
|
||||
selectedIndex: currentPageIndex,
|
||||
destinations: [
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.home_outlined),
|
||||
label: "Inicio",
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.watch_outlined),
|
||||
label: "Movimientos",
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.notifications_outlined),
|
||||
label: "Alertas",
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.person_outline_outlined),
|
||||
label: "Mi perfil",
|
||||
),
|
||||
],
|
||||
),
|
||||
body: bodies[currentPageIndex],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import 'package:dashboard_shell/src/presentation/main_shell_view_model.dart';
|
||||
import 'package:dashboard_shell/src/presentation/main_shell_view_state.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_riverpod/legacy.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
|
||||
final mainShellViewModelProvider =
|
||||
StateNotifierProvider.autoDispose<MainShellViewModel, MainShellViewState>(
|
||||
(ref) => MainShellViewModel(ref: ref),
|
||||
);
|
||||
|
||||
class DashboardScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
final StatefulNavigationShell navigationShell;
|
||||
|
||||
const DashboardScreen({
|
||||
super.key,
|
||||
required this.navigationContract,
|
||||
required this.navigationShell,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final viewState = ref.watch(mainShellViewModelProvider);
|
||||
final viewModel = ref.read(mainShellViewModelProvider.notifier);
|
||||
|
||||
return Scaffold(
|
||||
body: navigationShell,
|
||||
bottomNavigationBar: NavigationBar(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
selectedIndex: viewState.selectedIndex,
|
||||
onDestinationSelected: (index) {
|
||||
viewModel.onTabChanged(index);
|
||||
navigationShell.goBranch(index);
|
||||
},
|
||||
destinations: const [
|
||||
NavigationDestination(icon: Icon(Icons.home_outlined), label: "Home"),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.watch_outlined),
|
||||
label: "Activity",
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.notifications_outlined),
|
||||
label: "Notifications",
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.person_outline_outlined),
|
||||
label: "Profile",
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'package:dashboard_shell/src/presentation/main_shell_view_state.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_riverpod/legacy.dart';
|
||||
|
||||
class MainShellViewModel extends StateNotifier<MainShellViewState> {
|
||||
MainShellViewModel({required this.ref}) : super(MainShellViewState());
|
||||
|
||||
final Ref ref;
|
||||
|
||||
void onTabChanged(int index) {
|
||||
state = state.copyWith(selectedIndex: index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
part 'main_shell_view_state.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class MainShellViewState with _$MainShellViewState {
|
||||
const factory MainShellViewState({
|
||||
@Default(0) int selectedIndex,
|
||||
@Default(false) bool isLoading,
|
||||
@Default(false) bool isComplete,
|
||||
String? error,
|
||||
}) = _MainShellViewState;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'main_shell_view_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$MainShellViewState {
|
||||
|
||||
int get selectedIndex; bool get isLoading; bool get isComplete; String? get error;
|
||||
/// Create a copy of MainShellViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$MainShellViewStateCopyWith<MainShellViewState> get copyWith => _$MainShellViewStateCopyWithImpl<MainShellViewState>(this as MainShellViewState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is MainShellViewState&&(identical(other.selectedIndex, selectedIndex) || other.selectedIndex == selectedIndex)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.error, error) || other.error == error));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,selectedIndex,isLoading,isComplete,error);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MainShellViewState(selectedIndex: $selectedIndex, isLoading: $isLoading, isComplete: $isComplete, error: $error)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $MainShellViewStateCopyWith<$Res> {
|
||||
factory $MainShellViewStateCopyWith(MainShellViewState value, $Res Function(MainShellViewState) _then) = _$MainShellViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int selectedIndex, bool isLoading, bool isComplete, String? error
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$MainShellViewStateCopyWithImpl<$Res>
|
||||
implements $MainShellViewStateCopyWith<$Res> {
|
||||
_$MainShellViewStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final MainShellViewState _self;
|
||||
final $Res Function(MainShellViewState) _then;
|
||||
|
||||
/// Create a copy of MainShellViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? selectedIndex = null,Object? isLoading = null,Object? isComplete = null,Object? error = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
selectedIndex: null == selectedIndex ? _self.selectedIndex : selectedIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable
|
||||
as bool,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [MainShellViewState].
|
||||
extension MainShellViewStatePatterns on MainShellViewState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _MainShellViewState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _MainShellViewState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _MainShellViewState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _MainShellViewState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _MainShellViewState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _MainShellViewState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int selectedIndex, bool isLoading, bool isComplete, String? error)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _MainShellViewState() when $default != null:
|
||||
return $default(_that.selectedIndex,_that.isLoading,_that.isComplete,_that.error);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int selectedIndex, bool isLoading, bool isComplete, String? error) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _MainShellViewState():
|
||||
return $default(_that.selectedIndex,_that.isLoading,_that.isComplete,_that.error);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int selectedIndex, bool isLoading, bool isComplete, String? error)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _MainShellViewState() when $default != null:
|
||||
return $default(_that.selectedIndex,_that.isLoading,_that.isComplete,_that.error);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _MainShellViewState implements MainShellViewState {
|
||||
const _MainShellViewState({this.selectedIndex = 0, this.isLoading = false, this.isComplete = false, this.error});
|
||||
|
||||
|
||||
@override@JsonKey() final int selectedIndex;
|
||||
@override@JsonKey() final bool isLoading;
|
||||
@override@JsonKey() final bool isComplete;
|
||||
@override final String? error;
|
||||
|
||||
/// Create a copy of MainShellViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$MainShellViewStateCopyWith<_MainShellViewState> get copyWith => __$MainShellViewStateCopyWithImpl<_MainShellViewState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _MainShellViewState&&(identical(other.selectedIndex, selectedIndex) || other.selectedIndex == selectedIndex)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.error, error) || other.error == error));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,selectedIndex,isLoading,isComplete,error);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MainShellViewState(selectedIndex: $selectedIndex, isLoading: $isLoading, isComplete: $isComplete, error: $error)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$MainShellViewStateCopyWith<$Res> implements $MainShellViewStateCopyWith<$Res> {
|
||||
factory _$MainShellViewStateCopyWith(_MainShellViewState value, $Res Function(_MainShellViewState) _then) = __$MainShellViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int selectedIndex, bool isLoading, bool isComplete, String? error
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$MainShellViewStateCopyWithImpl<$Res>
|
||||
implements _$MainShellViewStateCopyWith<$Res> {
|
||||
__$MainShellViewStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _MainShellViewState _self;
|
||||
final $Res Function(_MainShellViewState) _then;
|
||||
|
||||
/// Create a copy of MainShellViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? selectedIndex = null,Object? isLoading = null,Object? isComplete = null,Object? error = freezed,}) {
|
||||
return _then(_MainShellViewState(
|
||||
selectedIndex: null == selectedIndex ? _self.selectedIndex : selectedIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable
|
||||
as bool,error: freezed == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -29,11 +29,17 @@ dependencies:
|
||||
get_it: ^9.0.5
|
||||
go_router: ^17.0.0
|
||||
flutter_riverpod: ^3.0.3
|
||||
freezed_annotation: ^3.1.0
|
||||
freezed: ^3.2.3
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^5.0.0
|
||||
riverpod_generator: ^3.0.3
|
||||
build_runner: ^2.7.1
|
||||
riverpod_lint: ^3.0.3
|
||||
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export 'src/presentation/home_screen.dart';
|
||||
export 'src/home_builder.dart';
|
||||
|
||||
11
modules/home/lib/src/home_builder.dart
Normal file
11
modules/home/lib/src/home_builder.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:home/home.dart';
|
||||
|
||||
class HomeBuilder {
|
||||
const HomeBuilder();
|
||||
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return MaterialPage(child: HomeScreen());
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:home/src/presentation/wallet_management_layout.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:home/src/presentation/wallet_management_layout.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:home/src/presentation/wallet_management_layout.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
|
||||
117
modules/home/lib/src/presentation/wallet_management_layout.dart
Normal file
117
modules/home/lib/src/presentation/wallet_management_layout.dart
Normal file
@@ -0,0 +1,117 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class WalletManagementLayout extends ConsumerWidget {
|
||||
final List<Widget> children;
|
||||
final Widget footer;
|
||||
final Kid kid;
|
||||
|
||||
const WalletManagementLayout({
|
||||
super.key,
|
||||
required this.kid,
|
||||
required this.children,
|
||||
required this.footer,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final content = [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
|
||||
child: Stack(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
icon: Icon(
|
||||
Icons.arrow_back_ios_outlined,
|
||||
color: theme.getColorFor(ThemeCode.textSecondary),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
kid.name,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 30,
|
||||
color: theme.getColorFor(ThemeCode.textSecondary),
|
||||
),
|
||||
),
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
text: "Saldo disponible: ",
|
||||
style: TextStyle(
|
||||
color: theme.getColorFor(ThemeCode.textSecondary),
|
||||
),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: "${kid.balance}",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: theme.getColorFor(ThemeCode.textSecondary),
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: "€",
|
||||
style: TextStyle(
|
||||
color: theme.getColorFor(ThemeCode.textSecondary),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
...children,
|
||||
];
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
body: Stack(
|
||||
children: [
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(30)),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: theme.getCardColorFor(0),
|
||||
),
|
||||
),
|
||||
child: SizedBox(width: double.infinity, height: 200),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 20),
|
||||
child: content[index],
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(height: 30, color: Colors.transparent);
|
||||
},
|
||||
itemCount: content.length,
|
||||
),
|
||||
),
|
||||
footer,
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,8 @@ dependencies:
|
||||
#dependencies go here
|
||||
flutter_svg: ^2.2.1
|
||||
flutter_riverpod: ^3.0.3
|
||||
|
||||
get_it: ^9.0.5
|
||||
go_router: ^17.0.0
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
export 'src/presentation/alert_screen.dart';
|
||||
export 'src/presentation/activity_screen.dart';
|
||||
export 'src/core/activity_list.dart';
|
||||
export 'src/activity_builder.dart';
|
||||
export 'src/notifications_builder.dart';
|
||||
|
||||
11
modules/notifications/lib/src/activity_builder.dart
Normal file
11
modules/notifications/lib/src/activity_builder.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:notifications/notifications.dart';
|
||||
|
||||
class ActivityBuilder {
|
||||
const ActivityBuilder();
|
||||
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return MaterialPage(child: ActivityScreen());
|
||||
}
|
||||
}
|
||||
11
modules/notifications/lib/src/notifications_builder.dart
Normal file
11
modules/notifications/lib/src/notifications_builder.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:notifications/notifications.dart';
|
||||
|
||||
class NotificationsBuilder {
|
||||
const NotificationsBuilder();
|
||||
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return MaterialPage(child: AlertScreen());
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,8 @@ dependencies:
|
||||
path: ../../packages/sf_shared
|
||||
#dependencies go here
|
||||
flutter_riverpod: ^3.0.3
|
||||
|
||||
get_it: ^9.0.5
|
||||
go_router: ^17.0.0
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export 'src/presentation/profile_screen.dart';
|
||||
export 'src/profile_builder.dart';
|
||||
|
||||
12
modules/profile/lib/src/profile_builder.dart
Normal file
12
modules/profile/lib/src/profile_builder.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:notifications/notifications.dart';
|
||||
import 'package:profile/profile.dart';
|
||||
|
||||
class ProfileBuilder {
|
||||
const ProfileBuilder();
|
||||
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return MaterialPage(child: ProfileScreen());
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,9 @@ dependencies:
|
||||
|
||||
#dependencies go here
|
||||
flutter_riverpod: ^3.0.3
|
||||
|
||||
get_it: ^9.0.5
|
||||
go_router: ^17.0.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
Reference in New Issue
Block a user