- create auth, main shell, home, profile, notifications and settings modules.

- added navigation, utils, design system and shared packages
- implemented go router in entiered app
- implemented flutter riverpod instead provider
This commit is contained in:
AlcalaJulian
2025-11-13 15:16:00 +01:00
parent 75beafd771
commit 5ca37d2822
332 changed files with 7759 additions and 3452 deletions

31
packages/sf_shared/.gitignore vendored Normal file
View File

@@ -0,0 +1,31 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.flutter-plugins-dependencies
/build/
/coverage/

View File

@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "adc901062556672b4138e18a4dc62a4be8f4b3c2"
channel: "stable"
project_type: package

View File

@@ -0,0 +1,3 @@
## 0.0.1
* TODO: Describe initial release.

View File

@@ -0,0 +1 @@
TODO: Add your license here.

View File

@@ -0,0 +1,39 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).
For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/to/develop-packages).
-->
TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
## Features
TODO: List what your package can do. Maybe include images, gifs, or videos.
## Getting started
TODO: List prerequisites and provide or point to information on how to
start using the package.
## Usage
TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
```dart
const like = 'sample';
```
## Additional information
TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.

View File

@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View File

@@ -0,0 +1,7 @@
export 'src/kid.dart';
export 'src/line_graph.dart';
export 'src/deposit_block.dart';
export 'src/wallet_management_layout.dart';
export 'src/connection_error_screen.dart';
export 'src/server_error_screen.dart';
export 'src/no_plan_error_screen.dart';

View File

@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class ConnectionErrorScreen extends StatelessWidget{
const ConnectionErrorScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
margin: EdgeInsets.all(30),
child: Center(
child: Column(
spacing: 15,
children: [
Spacer(flex: 2),
SvgPicture.asset("assets/images/ui/connection_error.svg"),
Text("Sin conexión a internet",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25)
),
Text("Necesitas conectividad para usar SaveFamily"),
Text("Puedes continuar en modo offline pero algunas funciones no estaràn disponibles"),
Spacer(flex: 1),
FilledButton(
onPressed: ()=>{},
child: Container(
width: double.infinity,
padding: EdgeInsets.all(20),
child: Text("Modo offline")
)
),
TextButton(onPressed: ()=>{}, child: Text("Reintentar")),
Spacer(flex: 2)
]
),
)
)
);
}
}

View File

@@ -0,0 +1,61 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class DepositBlock extends ConsumerWidget {
final double max;
const DepositBlock({super.key, required this.max});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
return Container(
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: theme.getColorFor(ThemeCode.backgroundPrimary),
borderRadius: BorderRadius.all(Radius.circular(20)),
),
margin: EdgeInsets.only(top: 10),
child: Column(
children: [
Text(
"Ingresar dinero en el wallet",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
),
Row(
spacing: 10,
children: [
Expanded(
child: TextField(
decoration: InputDecoration(
labelText: "Cantidad",
hintText: "0€",
border: OutlineInputBorder(),
),
keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
),
),
FilledButton(
onPressed: () => {},
style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll<Color>(
theme.getColorFor(ThemeCode.buttonPrimary),
),
),
child: Text("Ingresar"),
),
],
),
Align(
alignment: Alignment.topLeft,
child: Text("Máximo que puedes añadir: $max"),
),
],
),
);
}
}

View File

@@ -0,0 +1,10 @@
class Kid {
final String name;
final double balance;
const Kid({
required this.name,
required this.balance,
});
}

View File

@@ -0,0 +1,178 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class LineGraph extends ConsumerStatefulWidget {
final lines = [
[0, 1, 0, 1, 0, 1, 0],
[1, 0, 1, 0, 1, 0, 1],
];
LineGraph({super.key});
@override
ConsumerState<LineGraph> createState() => LineGraphState();
}
class LineGraphState extends ConsumerState<LineGraph> {
final weekDays = ["L", "M", "X", "J", "V", "S", "D"];
String? timeSpan;
late var days = weekDays;
@override
void initState() {
timeSpan = "week";
super.initState();
}
@override
Widget build(BuildContext context) {
final theme = ref.watch(themePortProvider);
return Container(
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
border: BoxBorder.fromLTRB(
left: BorderSide(color: Colors.cyan, width: 5),
),
borderRadius: BorderRadius.all(Radius.circular(20)),
color: theme.getColorFor(ThemeCode.backgroundPrimary),
),
child: Column(
spacing: 10,
children: [
Row(
children: [
Text("Gastos", style: TextStyle(fontWeight: FontWeight.bold)),
Spacer(),
Container(
padding: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: theme.getColorFor(ThemeCode.backgroundSecondary),
),
child: DropdownButton(
underline: Container(),
value: timeSpan,
onChanged: (String? value) {
setState(() {
timeSpan = value;
});
},
dropdownColor: theme.getColorFor(ThemeCode.backgroundPrimary),
items: [
DropdownMenuItem(value: "day", child: Text("Hoy")),
DropdownMenuItem(value: "week", child: Text("Esta semana")),
DropdownMenuItem(value: "month", child: Text("Este mes")),
],
),
),
],
),
Expanded(
child: LineChart(
LineChartData(
gridData: FlGridData(
show: true,
drawHorizontalLine: false,
drawVerticalLine: true,
verticalInterval: 1,
),
titlesData: FlTitlesData(
//show: false,
bottomTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
reservedSize: 40,
getTitlesWidget: (double value, TitleMeta meta) =>
SideTitleWidget(
space: 4,
meta: meta,
/*fitInside: fitInsideBottomTitle
? SideTitleFitInsideData.fromTitleMeta(meta, distanceFromEdge: 0)
: SideTitleFitInsideData.disable(),*/
child: Text(weekDays[value.toInt()]),
),
),
),
leftTitles: AxisTitles(),
topTitles: AxisTitles(),
rightTitles: AxisTitles(),
),
lineTouchData: LineTouchData(
touchTooltipData: LineTouchTooltipData(
getTooltipColor: (touchedSpot) =>
theme.getColorFor(ThemeCode.buttonSecondary),
getTooltipItems: (List<LineBarSpot> touchedBarSpots) {
return touchedBarSpots.map((barSpot) {
return LineTooltipItem(
"${barSpot.y}",
TextStyle(
color: theme.getColorFor(ThemeCode.textSecondary),
),
);
}).toList();
},
),
),
borderData: FlBorderData(
show: true,
border: Border(
bottom: BorderSide(
color: Colors.lightBlue.withValues(alpha: 0.2),
width: 4,
),
left: const BorderSide(color: Colors.transparent),
right: const BorderSide(color: Colors.transparent),
top: const BorderSide(color: Colors.transparent),
),
),
lineBarsData: [
LineChartBarData(
isCurved: true,
color: Colors.pink,
barWidth: 5,
isStrokeCapRound: true,
dotData: const FlDotData(show: false),
belowBarData: BarAreaData(show: false),
spots: const [
FlSpot(0, 1),
FlSpot(1, 0),
FlSpot(2, 1),
FlSpot(3, 0),
FlSpot(4, 1),
FlSpot(5, 0),
FlSpot(6, 1),
],
),
LineChartBarData(
isCurved: true,
color: Colors.cyan,
barWidth: 5,
isStrokeCapRound: true,
dotData: const FlDotData(show: false),
belowBarData: BarAreaData(show: false),
spots: const [
FlSpot(0, 0),
FlSpot(1, 1),
FlSpot(2, 0),
FlSpot(3, 1),
FlSpot(4, 0),
FlSpot(5, 1),
FlSpot(6, 0),
],
),
],
minX: 0,
maxX: days.length - 1,
maxY: 1,
minY: 0,
),
),
),
],
),
);
}
}

View File

@@ -0,0 +1,70 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class NoPlanErrorScreen extends ConsumerWidget {
const NoPlanErrorScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
return Scaffold(
body: Container(
margin: EdgeInsets.all(30),
child: Center(
child: Column(
children: [
Spacer(flex: 3),
Text(
"Estamos mejorando el servicio",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25),
),
Text(
"Asocia tu reloj a SaveFamily y ayuda a tus peques a aprender a usar el dinero con responsabilidad",
),
Container(
margin: EdgeInsets.symmetric(vertical: 20),
child: Column(
children: [
Row(
children: [
Icon(
Icons.check,
color: theme.getColorFor(ThemeCode.buttonPrimary),
),
Text("Desarrollarán hábitos financieros sanos"),
],
),
Row(
children: [
Icon(
Icons.check,
color: theme.getColorFor(ThemeCode.buttonPrimary),
),
Text("Gestiona sus gastos"),
],
),
],
),
),
Text(
"Selecciona tu plan en nuestra web y empieza a enseñar a los peques a entender el valor del dinero",
),
Spacer(flex: 1),
FilledButton(
onPressed: () => {},
child: Container(
width: double.infinity,
padding: EdgeInsets.all(20),
child: Text("Seleccionar plan"),
),
),
Spacer(flex: 3),
],
),
),
),
);
}
}

View File

@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class ServerErrorScreen extends StatelessWidget{
const ServerErrorScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
//backgroundColor: ,
body: Center(
child: Column(
spacing: 20,
children: [
Spacer(flex: 2),
Text("Estamos mejorando el servicio",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 25)
),
SvgPicture.asset("assets/images/ui/server_error.svg"),
Text("El sistema está en mantenimiento. \nInténtalo de nuevo en unos minutos"),
Spacer(flex: 1),
FilledButton(onPressed: ()=>{}, child: Text("Notificarme")),
TextButton(onPressed: ()=>{}, child: Text("Reintentar")),
Spacer(flex: 2)
]
),
)
);
}
}

View 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,
],
),
],
),
);
}
}

View File

@@ -0,0 +1,63 @@
name: sf_shared
description: "A new Flutter package project."
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.0.1
homepage:
environment:
sdk: ^3.9.2
flutter: ">=1.17.0"
dependencies:
flutter:
sdk: flutter
#packages dependencies go here
design_system:
path: ../design_system
#dependencies go here
fl_chart: ^1.1.1
flutter_svg: ^2.2.1
flutter_riverpod: ^3.0.3
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# To add assets to your package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/to/asset-from-package
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images
# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/to/font-from-package

View File

@@ -0,0 +1,4 @@
# melos_managed_dependency_overrides: design_system
dependency_overrides:
design_system:
path: ../design_system