- 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:
31
modules/notifications/.gitignore
vendored
Normal file
31
modules/notifications/.gitignore
vendored
Normal 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/
|
||||
10
modules/notifications/.metadata
Normal file
10
modules/notifications/.metadata
Normal 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
|
||||
3
modules/notifications/CHANGELOG.md
Normal file
3
modules/notifications/CHANGELOG.md
Normal file
@@ -0,0 +1,3 @@
|
||||
## 0.0.1
|
||||
|
||||
* TODO: Describe initial release.
|
||||
1
modules/notifications/LICENSE
Normal file
1
modules/notifications/LICENSE
Normal file
@@ -0,0 +1 @@
|
||||
TODO: Add your license here.
|
||||
39
modules/notifications/README.md
Normal file
39
modules/notifications/README.md
Normal 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.
|
||||
4
modules/notifications/analysis_options.yaml
Normal file
4
modules/notifications/analysis_options.yaml
Normal 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
|
||||
3
modules/notifications/lib/notifications.dart
Normal file
3
modules/notifications/lib/notifications.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
export 'src/presentation/alert_screen.dart';
|
||||
export 'src/presentation/activity_screen.dart';
|
||||
export 'src/core/activity_list.dart';
|
||||
106
modules/notifications/lib/src/core/activity_list.dart
Normal file
106
modules/notifications/lib/src/core/activity_list.dart
Normal file
@@ -0,0 +1,106 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class ActivityList extends ConsumerStatefulWidget {
|
||||
final List activity;
|
||||
bool edit = false;
|
||||
|
||||
ActivityList({super.key, required this.activity, required this.edit});
|
||||
|
||||
@override
|
||||
ConsumerState<ActivityList> createState() => ActivityListState();
|
||||
}
|
||||
|
||||
class ActivityListState extends ConsumerState<ActivityList> {
|
||||
late List<bool> values;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
values = List<bool>.generate(widget.activity.length, (_) => false);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final colors = [
|
||||
Colors.cyan,
|
||||
Colors.pinkAccent,
|
||||
Colors.deepOrangeAccent,
|
||||
Colors.red,
|
||||
];
|
||||
final icons = {
|
||||
"wage": Icons.wallet,
|
||||
"goal": Icons.emoji_events_outlined,
|
||||
"lock": Icons.lock_outline,
|
||||
"reload": Icons.attach_money_outlined,
|
||||
};
|
||||
final titles = {
|
||||
"wage": "Entrega de paga",
|
||||
"goal": "¡Objetivo cumplido!",
|
||||
"lock": "Bloqueo de pago",
|
||||
"reload": "Recarga familiar",
|
||||
};
|
||||
|
||||
return Column(
|
||||
spacing: 20,
|
||||
children: List<Widget>.generate(widget.activity.length, (int index) {
|
||||
var logItem = Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
border: BoxBorder.fromLTRB(
|
||||
left: BorderSide(color: colors[index % colors.length], width: 5),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 15,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
icons[widget.activity[index]["type"]],
|
||||
color: colors[index % colors.length],
|
||||
),
|
||||
Text(
|
||||
titles[widget.activity[index]["type"]]!,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
|
||||
),
|
||||
Spacer(),
|
||||
Text("14/01/2005"),
|
||||
],
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Text("Ana ya tiene su paga de 5€ en el reloj"),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
if (widget.edit) {
|
||||
return Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: values[index],
|
||||
onChanged: (value) => {
|
||||
setState(() {
|
||||
values[index] = !values[index];
|
||||
}),
|
||||
},
|
||||
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
|
||||
semanticLabel: "Eliminar",
|
||||
),
|
||||
Expanded(child: logItem),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return logItem;
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:notifications/src/core/activity_list.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
class ActivityScreen extends ConsumerWidget {
|
||||
ActivityScreen({super.key});
|
||||
|
||||
final activity = [
|
||||
{"type": "goal"},
|
||||
{"type": "wage", "amount": 5},
|
||||
{"type": "lock"},
|
||||
{"type": "lock"},
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final content = [
|
||||
Text(
|
||||
"Movimientos recientes",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
|
||||
),
|
||||
Row(
|
||||
spacing: 20,
|
||||
children: [
|
||||
FilledButton(onPressed: () => {}, child: Text("Hoy")),
|
||||
Spacer(),
|
||||
TextButton(onPressed: () => {}, child: Text("Última semana")),
|
||||
TextButton(onPressed: () => {}, child: Text("Mes")),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 200, child: LineGraph()),
|
||||
ActivityList(activity: activity, edit: false),
|
||||
];
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
body: Container(
|
||||
margin: EdgeInsets.fromLTRB(30, 30, 30, 0),
|
||||
child: Center(
|
||||
child: ListView.separated(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return content[index];
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(color: Colors.transparent, height: 30);
|
||||
},
|
||||
itemCount: content.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
56
modules/notifications/lib/src/presentation/alert_screen.dart
Normal file
56
modules/notifications/lib/src/presentation/alert_screen.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:notifications/src/core/activity_list.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class AlertScreen extends ConsumerStatefulWidget {
|
||||
const AlertScreen({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<AlertScreen> createState() => AlertScreenState();
|
||||
}
|
||||
|
||||
class AlertScreenState extends ConsumerState<AlertScreen> {
|
||||
final activity = [
|
||||
{"type": "goal"},
|
||||
{"type": "wage", "amount": 5},
|
||||
{"type": "lock"},
|
||||
{"type": "lock"},
|
||||
];
|
||||
bool edit = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
edit = false;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
body: Container(
|
||||
margin: EdgeInsets.all(30),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text("Alertas"),
|
||||
Spacer(),
|
||||
TextButton(
|
||||
onPressed: () => setState(() {
|
||||
edit = !edit;
|
||||
}),
|
||||
child: Text("Editar"),
|
||||
),
|
||||
],
|
||||
),
|
||||
ActivityList(activity: activity, edit: edit),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
65
modules/notifications/pubspec.yaml
Normal file
65
modules/notifications/pubspec.yaml
Normal file
@@ -0,0 +1,65 @@
|
||||
name: notifications
|
||||
# resolution: workspace
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
description: "A new Flutter package project."
|
||||
version: 0.0.1
|
||||
homepage:
|
||||
|
||||
environment:
|
||||
sdk: ^3.9.2
|
||||
flutter: ">=1.17.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
#modules dependencies go here
|
||||
design_system:
|
||||
path: ../../packages/design_system
|
||||
#packages dependencies go here
|
||||
sf_shared:
|
||||
path: ../../packages/sf_shared
|
||||
#dependencies go here
|
||||
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
|
||||
6
modules/notifications/pubspec_overrides.yaml
Normal file
6
modules/notifications/pubspec_overrides.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
# melos_managed_dependency_overrides: design_system,sf_shared
|
||||
dependency_overrides:
|
||||
design_system:
|
||||
path: ../../packages/design_system
|
||||
sf_shared:
|
||||
path: ../../packages/sf_shared
|
||||
Reference in New Issue
Block a user