-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from TI-TecnicamenteIdiotas/develop
Release - 2023/06/24
- Loading branch information
Showing
89 changed files
with
3,858 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="production" type="FlutterRunConfigurationType" factoryName="Flutter"> | ||
<option name="additionalArgs" value="--dart-define-from-file=config.production.json --release" /> | ||
<option name="filePath" value="$PROJECT_DIR$/lib/main.dart" /> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
android/app/src/main/java/com/nimbleflow/nimbleflow/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.nimbleflow.nimbleflow; | ||
package com.nimbleflow; | ||
|
||
import io.flutter.embedding.android.FlutterActivity; | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"CATEGORY_BASE_SERVICE_URL": "http://10.0.2.2:10506", | ||
"ORDER_BASE_SERVICE_URL": "http://10.0.2.2:10507", | ||
"PRODUCT_BASE_SERVICE_URL": "http://10.0.2.2:10506", | ||
"TABLE_BASE_SERVICE_URL": "http://10.0.2.2:10506", | ||
"MAIN_HUB_BASE_SERVICE_URL": "http://10.0.2.2:10504", | ||
"UPLOAD_BASE_SERVICE_URL": "http://10.0.2.2:10506" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"CATEGORY_BASE_SERVICE_URL": "http://192.168.15.131:10506", | ||
"ORDER_BASE_SERVICE_URL": "http://192.168.15.131:10507", | ||
"PRODUCT_BASE_SERVICE_URL": "http://192.168.15.131:10506", | ||
"TABLE_BASE_SERVICE_URL": "http://192.168.15.131:10506", | ||
"MAIN_HUB_BASE_SERVICE_URL": "http://192.168.15.131:10504", | ||
"UPLOAD_BASE_SERVICE_URL": "http://192.168.15.131:10506" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:nimbleflow/home/categories/utils/category_hub_subscribers.dart'; | ||
import 'package:nimbleflow/home/categories/widgets/list_of_categories_widget.dart'; | ||
import 'package:nimbleflow/shared/constants/global_keys_constants.dart'; | ||
import 'package:nimbleflow/home/categories/models/category_model.dart'; | ||
import 'package:nimbleflow/shared/services/hub_service.dart'; | ||
import 'package:nimbleflow/shared/storage/storage.dart'; | ||
|
||
import '../../shared/widgets/loading_dialog_widget.dart'; | ||
|
||
class CategoriesModulePage extends StatefulWidget { | ||
final List<CategoryModel> listOfCategories; | ||
final bool isLoading; | ||
|
||
const CategoriesModulePage(this.listOfCategories, this.isLoading, | ||
{super.key}); | ||
|
||
@override | ||
State<CategoriesModulePage> createState() => _CategoriesModulePageState(); | ||
} | ||
|
||
class _CategoriesModulePageState extends State<CategoriesModulePage> { | ||
late final CategoryHubSubscriber categoryHubSubscriber; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
categoryHubSubscriber = CategoryHubSubscriber( | ||
widget.listOfCategories, | ||
HubService.mainHubConnection, | ||
Storage.storage, | ||
setState, | ||
); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
super.dispose(); | ||
categoryHubSubscriber.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar(title: const Text("Categorias")), | ||
body: MaterialApp( | ||
theme: Theme.of(context), | ||
debugShowCheckedModeBanner: false, | ||
navigatorKey: kCategoriesModuleNavigatorKey, | ||
home: Builder( | ||
builder: (_) { | ||
if (widget.isLoading) { | ||
return const Center(child: LoadingDialogWidget()); | ||
} | ||
return ListOfCategoriesWidget(widget.listOfCategories); | ||
}, | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const kListOfCategoriesLimit = 64; | ||
|
||
const kMaxTitleLength = 32; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class CreateCategoryDto { | ||
String title; | ||
int? colorTheme; | ||
int? categoryIcon; | ||
|
||
CreateCategoryDto({ | ||
required this.title, | ||
this.colorTheme, | ||
this.categoryIcon, | ||
}); | ||
|
||
Map<String, dynamic> toJson() { | ||
return { | ||
"title": title, | ||
"colorTheme": colorTheme, | ||
"categoryIcon": categoryIcon, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class UpdateCategoryDto { | ||
final String id; | ||
String? title; | ||
int? colorTheme; | ||
int? categoryIcon; | ||
|
||
UpdateCategoryDto({ | ||
required this.id, | ||
this.title, | ||
this.colorTheme, | ||
this.categoryIcon, | ||
}); | ||
|
||
Map<String, dynamic> toJson() { | ||
return { | ||
"title": title, | ||
"colorTheme": colorTheme, | ||
"categoryIcon": categoryIcon, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'package:nimbleflow/shared/constants/storage_constants.dart'; | ||
|
||
class CategoryModel { | ||
final String id; | ||
String title; | ||
int? colorTheme; | ||
int? categoryIcon; | ||
|
||
CategoryModel({ | ||
required this.id, | ||
required this.title, | ||
this.colorTheme, | ||
this.categoryIcon, | ||
}); | ||
|
||
factory CategoryModel.fromStorageMap(Map<String, dynamic> map) { | ||
return CategoryModel( | ||
id: map["${kCategoryTableName}_id"], | ||
title: map["${kCategoryTableName}_title"], | ||
colorTheme: map["${kCategoryTableName}_colorTheme"], | ||
categoryIcon: map["${kCategoryTableName}_categoryIcon"], | ||
); | ||
} | ||
|
||
Map<String, dynamic> toStorageMap() { | ||
return { | ||
"id": id, | ||
"title": title, | ||
"colorTheme": colorTheme, | ||
"categoryIcon": categoryIcon, | ||
}; | ||
} | ||
|
||
factory CategoryModel.fromJson(Map<String, dynamic> json) { | ||
return CategoryModel( | ||
id: json["id"], | ||
title: json["title"], | ||
colorTheme: json["colorTheme"], | ||
categoryIcon: json["categoryIcon"], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'package:nimbleflow/home/categories/models/category_model.dart'; | ||
|
||
class PaginatedCategoryModel { | ||
final int totalItems; | ||
final List<CategoryModel> items; | ||
|
||
PaginatedCategoryModel({ | ||
required this.totalItems, | ||
required this.items, | ||
}); | ||
|
||
factory PaginatedCategoryModel.fromJson(Map<String, dynamic> json) { | ||
var itemsIterable = Iterable | ||
.castFrom<dynamic, Map<String, dynamic>>(json["items"]) | ||
.map(CategoryModel.fromJson); | ||
|
||
return PaginatedCategoryModel( | ||
totalItems: json["totalItems"], | ||
items: List.from(itemsIterable), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:nimbleflow/home/categories/dtos/update_category_dto.dart'; | ||
import 'package:nimbleflow/home/categories/models/category_model.dart'; | ||
import 'package:nimbleflow/home/categories/widgets/category_detailed_widget.dart'; | ||
|
||
import '../../../shared/constants/layout_constants.dart'; | ||
import '../../../shared/widgets/delete_button_widget.dart'; | ||
import '../../../shared/widgets/save_button_widget.dart'; | ||
import '../services/category_service.dart'; | ||
|
||
class CategoryPage extends StatefulWidget { | ||
final CategoryModel category; | ||
|
||
const CategoryPage(this.category, {super.key}); | ||
|
||
@override | ||
State<CategoryPage> createState() => _CategoryPageState(); | ||
} | ||
|
||
class _CategoryPageState extends State<CategoryPage> { | ||
final formKey = GlobalKey<FormState>(); | ||
final titleTextEditingController = TextEditingController(); | ||
int? categoryIcon; | ||
int? colorTheme; | ||
|
||
void setCategoryIcon(IconData? value) { | ||
if (value == null) return; | ||
|
||
setState(() => categoryIcon = kListOfIcons.indexOf(value)); | ||
} | ||
|
||
void setColorTheme(Color? value) { | ||
if (value == null) return; | ||
|
||
setState(() => colorTheme = kListOfColors.indexOf(value)); | ||
} | ||
|
||
Future<bool> save() async { | ||
if (!formKey.currentState!.validate()) return false; | ||
|
||
await CategoryService.httpPutCategory(UpdateCategoryDto( | ||
id: widget.category.id, | ||
title: titleTextEditingController.text, | ||
categoryIcon: categoryIcon, | ||
colorTheme: colorTheme, | ||
)); | ||
|
||
return true; | ||
} | ||
|
||
Future<void> delete() async { | ||
await CategoryService.httpDeleteCategory(widget.category.id); | ||
} | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
titleTextEditingController.text = widget.category.title; | ||
categoryIcon = widget.category.categoryIcon; | ||
colorTheme = widget.category.colorTheme; | ||
} | ||
|
||
@override | ||
void didUpdateWidget(covariant CategoryPage oldWidget) { | ||
super.didUpdateWidget(oldWidget); | ||
titleTextEditingController.text = widget.category.title; | ||
categoryIcon = widget.category.categoryIcon; | ||
colorTheme = widget.category.colorTheme; | ||
} | ||
|
||
@override | ||
void dispose() { | ||
super.dispose(); | ||
titleTextEditingController.dispose(); | ||
formKey.currentState?.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return CategoryDetailed( | ||
formKey: formKey, | ||
titleTextEditingController: titleTextEditingController, | ||
colorTheme: colorTheme, | ||
setColorTheme: setColorTheme, | ||
categoryIcon: categoryIcon, | ||
setCategoryIcon: setCategoryIcon, | ||
floatingActionButtons: [ | ||
SaveButtonWidget(onPressed: save), | ||
DeleteButtonWidget(onPressed: delete), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:nimbleflow/home/categories/services/category_service.dart'; | ||
import 'package:nimbleflow/home/categories/widgets/category_detailed_widget.dart'; | ||
import 'package:nimbleflow/shared/constants/layout_constants.dart'; | ||
|
||
import '../../../shared/widgets/cancel_button_widget.dart'; | ||
import '../../../shared/widgets/create_button_widget.dart'; | ||
import '../dtos/create_category_dto.dart'; | ||
|
||
class CreateCategoryPage extends StatefulWidget { | ||
const CreateCategoryPage({super.key}); | ||
|
||
@override | ||
State<CreateCategoryPage> createState() => _CreateCategoryPageState(); | ||
} | ||
|
||
class _CreateCategoryPageState extends State<CreateCategoryPage> { | ||
final formKey = GlobalKey<FormState>(); | ||
|
||
final titleTextEditingController = TextEditingController(); | ||
int? categoryIcon; | ||
int? colorTheme; | ||
|
||
void setCategoryIcon(IconData? value) { | ||
if (value == null) return; | ||
|
||
setState(() => categoryIcon = kListOfIcons.indexOf(value)); | ||
} | ||
|
||
void setColorTheme(Color? value) { | ||
if (value == null) return; | ||
|
||
setState(() => colorTheme = kListOfColors.indexOf(value)); | ||
} | ||
|
||
Future<bool> create() async { | ||
if (!formKey.currentState!.validate()) return false; | ||
|
||
await CategoryService.httpPostCategory( | ||
CreateCategoryDto( | ||
title: titleTextEditingController.text, | ||
colorTheme: colorTheme, | ||
categoryIcon: categoryIcon, | ||
), | ||
); | ||
|
||
return true; | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return CategoryDetailed( | ||
appBarText: "Nova categoria", | ||
formKey: formKey, | ||
titleTextEditingController: titleTextEditingController, | ||
colorTheme: colorTheme, | ||
setColorTheme: setColorTheme, | ||
categoryIcon: categoryIcon, | ||
setCategoryIcon: setCategoryIcon, | ||
floatingActionButtons: [ | ||
CreateButtonWidget(onPressed: create), | ||
const CancelButtonWidget(), | ||
], | ||
); | ||
} | ||
} |
Oops, something went wrong.