lint recommended! null-safety working finished
parent
6590fba912
commit
94823fcd56
|
|
@ -1,3 +1,27 @@
|
||||||
analyzer:
|
include: package:lint/analysis_options.yaml
|
||||||
enable-experiment:
|
|
||||||
- non-nullable
|
# Not happy with the default? Customize the rules depending on your needs.
|
||||||
|
# Here are some examples:
|
||||||
|
linter:
|
||||||
|
rules:
|
||||||
|
# Make constructors the first thing in every class
|
||||||
|
sort_constructors_first: true
|
||||||
|
|
||||||
|
# The new tabs vs. spaces. Choose wisely
|
||||||
|
prefer_single_quotes: true
|
||||||
|
prefer_double_quotes: false
|
||||||
|
|
||||||
|
# Good packages document everything
|
||||||
|
public_member_api_docs: false
|
||||||
|
|
||||||
|
# Blindly follow the Flutter code style, which prefers types everywhere
|
||||||
|
always_specify_types: false
|
||||||
|
|
||||||
|
# Back to the 80s
|
||||||
|
lines_longer_than_80_chars: true
|
||||||
|
|
||||||
|
# Use parameter order as in json response
|
||||||
|
always_put_required_named_parameters_first: true
|
||||||
|
|
||||||
|
# Util classes are awesome!
|
||||||
|
avoid_classes_with_only_static_members: true
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
const String CategoryTableName = 'goods_category';
|
|
||||||
const String CategoryColumnId = 'id';
|
|
||||||
const String CategoryColumnParentIn = 'parent_id';
|
|
||||||
const String CategoryColumnName = 'name';
|
|
||||||
const String CategoryColumnAppCompanyId = 'app_company_id';
|
|
||||||
const String CategoryColumnUpdatedAt = 'updated_at';
|
|
||||||
|
|
||||||
class Category {
|
|
||||||
int? id;
|
|
||||||
int? parentId;
|
|
||||||
String? name;
|
|
||||||
int? appCompanyId;
|
|
||||||
String? updatedAt;
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
|
||||||
var map = <String, dynamic>{
|
|
||||||
CategoryColumnParentIn: parentId,
|
|
||||||
CategoryColumnName: name,
|
|
||||||
CategoryColumnAppCompanyId: appCompanyId,
|
|
||||||
CategoryColumnUpdatedAt: updatedAt,
|
|
||||||
};
|
|
||||||
if (id != null) {
|
|
||||||
map[CategoryColumnId] = id;
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
Category();
|
|
||||||
|
|
||||||
Category.fromMap(Map<String, dynamic> map) {
|
|
||||||
id = map[CategoryColumnId];
|
|
||||||
parentId = map[CategoryColumnParentIn];
|
|
||||||
name = map[CategoryColumnName];
|
|
||||||
appCompanyId = map[CategoryColumnAppCompanyId];
|
|
||||||
updatedAt = map[CategoryColumnUpdatedAt];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
const String TransactionTableName = 'transactions';
|
|
||||||
const String TransactionColumnId = 'id';
|
|
||||||
const String TransactionColumnUuid = 'uuid';
|
|
||||||
const String TransactionColumnType = 'type';
|
|
||||||
const String TransactionColumnStatus = 'status';
|
|
||||||
const String TransactionColumnData = 'data';
|
|
||||||
const String TransactionColumnAppCompanyId = 'appCompanyId';
|
|
||||||
const String TransactionColumnCreatedAt = 'createdAt';
|
|
||||||
|
|
||||||
const int TransactionTypeSell = 1;
|
|
||||||
const int TransactionTypeBuy = 2;
|
|
||||||
|
|
||||||
const int TransactionStatusPrepare = 0;
|
|
||||||
|
|
||||||
|
|
||||||
class Transaction {
|
|
||||||
int? id;
|
|
||||||
String? uuid;
|
|
||||||
int? type;
|
|
||||||
int? status;
|
|
||||||
String? data;
|
|
||||||
int? appCompanyId;
|
|
||||||
String? createdAt;
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
|
||||||
var map = <String, dynamic>{
|
|
||||||
TransactionColumnUuid: uuid,
|
|
||||||
TransactionColumnType: type,
|
|
||||||
TransactionColumnStatus: status,
|
|
||||||
TransactionColumnData: data,
|
|
||||||
TransactionColumnAppCompanyId: appCompanyId,
|
|
||||||
TransactionColumnCreatedAt: createdAt,
|
|
||||||
};
|
|
||||||
if (id != null) {
|
|
||||||
map[TransactionColumnId] = id;
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
Transaction();
|
|
||||||
|
|
||||||
Transaction.fromMap(Map<String, dynamic> map) {
|
|
||||||
id = map[TransactionColumnId];
|
|
||||||
uuid = map[TransactionColumnUuid];
|
|
||||||
type = map[TransactionColumnType];
|
|
||||||
status = map[TransactionColumnStatus];
|
|
||||||
appCompanyId = map[TransactionColumnAppCompanyId];
|
|
||||||
data = map[TransactionColumnData];
|
|
||||||
createdAt = map[TransactionColumnCreatedAt];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
const String categoryTableName = 'goods_category';
|
||||||
|
const String categoryColumnId = 'id';
|
||||||
|
const String categoryColumnParentIn = 'parent_id';
|
||||||
|
const String categoryColumnName = 'name';
|
||||||
|
const String categoryColumnAppCompanyId = 'app_company_id';
|
||||||
|
const String categoryColumnUpdatedAt = 'updated_at';
|
||||||
|
|
||||||
|
class Category {
|
||||||
|
|
||||||
|
Category();
|
||||||
|
|
||||||
|
Category.fromMap(Map<String, dynamic> map) {
|
||||||
|
id = map[categoryColumnId] as int;
|
||||||
|
parentId = map[categoryColumnParentIn] as int;
|
||||||
|
name = map[categoryColumnName] as String;
|
||||||
|
appCompanyId = map[categoryColumnAppCompanyId] as int;
|
||||||
|
updatedAt = map[categoryColumnUpdatedAt] as String;
|
||||||
|
}
|
||||||
|
|
||||||
|
int? id;
|
||||||
|
int? parentId;
|
||||||
|
String? name;
|
||||||
|
int? appCompanyId;
|
||||||
|
String? updatedAt;
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
final Map<String, dynamic> map = <String, dynamic>{
|
||||||
|
categoryColumnParentIn: parentId,
|
||||||
|
categoryColumnName: name,
|
||||||
|
categoryColumnAppCompanyId: appCompanyId,
|
||||||
|
categoryColumnUpdatedAt: updatedAt,
|
||||||
|
};
|
||||||
|
if (id != null) {
|
||||||
|
map[categoryColumnId] = id;
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const String GoodTableName = 'goods';
|
const String goodTableName = 'goods';
|
||||||
const String GoodColumnId = 'id';
|
const String GoodColumnId = 'id';
|
||||||
const String GoodColumnCategoryId = 'category_id';
|
const String GoodColumnCategoryId = 'category_id';
|
||||||
const String GoodColumnName = 'name';
|
const String GoodColumnName = 'name';
|
||||||
|
|
@ -12,6 +12,21 @@ const String GoodColumnUpdatedAt = 'updated_at';
|
||||||
const String GoodColumnAppCompanyId = 'app_company_id';
|
const String GoodColumnAppCompanyId = 'app_company_id';
|
||||||
|
|
||||||
class Good {
|
class Good {
|
||||||
|
Good();
|
||||||
|
Good.fromMap(Map<String, dynamic> map) {
|
||||||
|
id = map[GoodColumnId] as int;
|
||||||
|
articul = map[GoodColumnArticul] as int;
|
||||||
|
name = (map[GoodColumnName] ?? '') as String ;
|
||||||
|
price = map[GoodColumnPrice] as num;
|
||||||
|
categoryId = map[GoodColumnCategoryId] as int;
|
||||||
|
ean = map[GoodColumnEan] as String;
|
||||||
|
appCompanyId = map[GoodColumnAppCompanyId] as int;
|
||||||
|
optPrice = map[GoodColumnOptPrice] as num;
|
||||||
|
basePrice = map[GoodColumnBasePrice] as num;
|
||||||
|
divisible = map[GoodColumnDivisible] as int;
|
||||||
|
updatedAt = map[GoodColumnUpdatedAt] as String;
|
||||||
|
}
|
||||||
|
|
||||||
int? id;
|
int? id;
|
||||||
int? categoryId;
|
int? categoryId;
|
||||||
String name = '';
|
String name = '';
|
||||||
|
|
@ -24,8 +39,10 @@ class Good {
|
||||||
String? updatedAt;
|
String? updatedAt;
|
||||||
int? appCompanyId;
|
int? appCompanyId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
var map = <String, dynamic>{
|
final Map<String, dynamic> map = <String, dynamic>{
|
||||||
GoodColumnArticul: articul,
|
GoodColumnArticul: articul,
|
||||||
GoodColumnName: name,
|
GoodColumnName: name,
|
||||||
GoodColumnPrice: price,
|
GoodColumnPrice: price,
|
||||||
|
|
@ -43,19 +60,7 @@ class Good {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
Good();
|
|
||||||
|
|
||||||
Good.fromMap(Map<String, dynamic> map) {
|
|
||||||
id = map[GoodColumnId];
|
|
||||||
articul = map[GoodColumnArticul];
|
|
||||||
name = map[GoodColumnName];
|
|
||||||
price = map[GoodColumnPrice]?.toDouble();
|
|
||||||
categoryId = map[GoodColumnCategoryId];
|
|
||||||
ean = map[GoodColumnEan];
|
|
||||||
appCompanyId = map[GoodColumnAppCompanyId];
|
|
||||||
optPrice = map[GoodColumnOptPrice];
|
|
||||||
basePrice = map[GoodColumnBasePrice];
|
|
||||||
divisible = map[GoodColumnDivisible];
|
|
||||||
updatedAt = map[GoodColumnUpdatedAt];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
const String transactionTableName = 'transactions';
|
||||||
|
const String transactionColumnId = 'id';
|
||||||
|
const String transactionColumnUuid = 'uuid';
|
||||||
|
const String transactionColumnType = 'type';
|
||||||
|
const String transactionColumnStatus = 'status';
|
||||||
|
const String transactionColumnData = 'data';
|
||||||
|
const String transactionColumnAppCompanyId = 'appCompanyId';
|
||||||
|
const String transactionColumnCreatedAt = 'createdAt';
|
||||||
|
|
||||||
|
const int transactionTypeSell = 1;
|
||||||
|
const int transactionTypeBuy = 2;
|
||||||
|
|
||||||
|
const int transactionStatusPrepare = 0;
|
||||||
|
|
||||||
|
|
||||||
|
class Transaction {
|
||||||
|
|
||||||
|
Transaction();
|
||||||
|
|
||||||
|
Transaction.fromMap(Map<String, dynamic> map) {
|
||||||
|
id = map[transactionColumnId] as int;
|
||||||
|
uuid = map[transactionColumnUuid] as String;
|
||||||
|
type = map[transactionColumnType] as int;
|
||||||
|
status = map[transactionColumnStatus] as int;
|
||||||
|
appCompanyId = map[transactionColumnAppCompanyId] as int;
|
||||||
|
data = map[transactionColumnData] as String;
|
||||||
|
createdAt = map[transactionColumnCreatedAt] as String;
|
||||||
|
}
|
||||||
|
|
||||||
|
int? id;
|
||||||
|
String? uuid;
|
||||||
|
int? type;
|
||||||
|
int? status;
|
||||||
|
String? data;
|
||||||
|
int? appCompanyId;
|
||||||
|
String? createdAt;
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
final Map<String, dynamic> map = <String, dynamic>{
|
||||||
|
transactionColumnUuid: uuid,
|
||||||
|
transactionColumnType: type,
|
||||||
|
transactionColumnStatus: status,
|
||||||
|
transactionColumnData: data,
|
||||||
|
transactionColumnAppCompanyId: appCompanyId,
|
||||||
|
transactionColumnCreatedAt: createdAt,
|
||||||
|
};
|
||||||
|
if (id != null) {
|
||||||
|
map[transactionColumnId] = id;
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -17,29 +17,30 @@ class AuthResponse {
|
||||||
String? message;
|
String? message;
|
||||||
bool? operation;
|
bool? operation;
|
||||||
|
|
||||||
|
static AuthResponse fromMap(dynamic map) {
|
||||||
static AuthResponse? fromMap(Map<String, dynamic> map) {
|
final AuthResponse authResponseBean = AuthResponse();
|
||||||
if (map == null) return null;
|
authResponseBean.userId = map['user_id'] as int;
|
||||||
AuthResponse authResponseBean = AuthResponse();
|
authResponseBean.companyId = map['company_id'] as int;
|
||||||
authResponseBean.userId = map['user_id'];
|
authResponseBean.kassaId = map['kassa_id'] as int;
|
||||||
authResponseBean.companyId = map['company_id'];
|
authResponseBean.token = map['token']?.toString();
|
||||||
authResponseBean.kassaId = map['kassa_id'];
|
authResponseBean.authAt = map['auth_at']?.toString();
|
||||||
authResponseBean.token = map['token'];
|
authResponseBean.shard = map['shard'] as int;
|
||||||
authResponseBean.authAt = map['auth_at'];
|
authResponseBean.message = map['message']?.toString();
|
||||||
authResponseBean.shard = map['shard'];
|
authResponseBean.operation = map['operation'] as bool;
|
||||||
authResponseBean.message = map['message'];
|
|
||||||
authResponseBean.operation = map['operation'];
|
|
||||||
return authResponseBean;
|
return authResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map toJson() => {
|
Map<String, dynamic> toJson() {
|
||||||
"user_id": userId,
|
final Map<String, dynamic> map = <String, dynamic>{
|
||||||
"company_id": companyId,
|
'user_id': userId,
|
||||||
"kassa_id": kassaId,
|
'company_id': companyId,
|
||||||
"token": token,
|
'kassa_id': kassaId,
|
||||||
"auth_at": authAt,
|
'token': token,
|
||||||
"shard": shard,
|
'auth_at': authAt,
|
||||||
"message": message,
|
'shard': shard,
|
||||||
"operation": operation,
|
'message': message,
|
||||||
};
|
'operation': operation,
|
||||||
}
|
};
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,13 @@ class CategoryResponse {
|
||||||
String? name;
|
String? name;
|
||||||
String? updatedAt;
|
String? updatedAt;
|
||||||
|
|
||||||
static CategoryResponse? fromMap(Map<String, dynamic> map) {
|
static CategoryResponse? fromMap(dynamic map) {
|
||||||
if (map == null) return null;
|
if (map == null) return null;
|
||||||
CategoryResponse categoryResponseBean = CategoryResponse();
|
final CategoryResponse categoryResponseBean = CategoryResponse();
|
||||||
categoryResponseBean.id = map['id'];
|
categoryResponseBean.id = map['id'] as int;
|
||||||
categoryResponseBean.parentId = map['parent_id'];
|
categoryResponseBean.parentId = map['parent_id'] as int;
|
||||||
categoryResponseBean.name = map['name'];
|
categoryResponseBean.name = map['name'] as String;
|
||||||
categoryResponseBean.updatedAt = map['updated_at'];
|
categoryResponseBean.updatedAt = map['updated_at'] as String;
|
||||||
return categoryResponseBean;
|
return categoryResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,32 +21,34 @@ class GoodResponse {
|
||||||
int? divisible;
|
int? divisible;
|
||||||
String? updatedAt;
|
String? updatedAt;
|
||||||
|
|
||||||
static GoodResponse? fromMap(Map<String, dynamic> map) {
|
static GoodResponse fromMap(dynamic map) {
|
||||||
if (map == null) return null;
|
final GoodResponse goodResponseBean = GoodResponse();
|
||||||
GoodResponse goodResponseBean = GoodResponse();
|
goodResponseBean.id = map['id'] as int;
|
||||||
goodResponseBean.id = map['id'];
|
goodResponseBean.categoryId = map['category_id'] as int;
|
||||||
goodResponseBean.categoryId = map['category_id'];
|
goodResponseBean.name = map['name'] as String;
|
||||||
goodResponseBean.name = map['name'];
|
goodResponseBean.ean = map['ean'] as String;
|
||||||
goodResponseBean.ean = map['ean'];
|
goodResponseBean.articul = map['articul'] as int;
|
||||||
goodResponseBean.articul = map['articul'];
|
goodResponseBean.price = map['price'] as int;
|
||||||
goodResponseBean.price = map['price'];
|
goodResponseBean.optPrice = map['opt_price'] as int;
|
||||||
goodResponseBean.optPrice = map['opt_price'];
|
goodResponseBean.basePrice = map['base_price'] as int;
|
||||||
goodResponseBean.basePrice = map['base_price'];
|
goodResponseBean.divisible = map['divisible'] as int;
|
||||||
goodResponseBean.divisible = map['divisible'];
|
goodResponseBean.updatedAt = map['updated_at'] as String;
|
||||||
goodResponseBean.updatedAt = map['updated_at'];
|
|
||||||
return goodResponseBean;
|
return goodResponseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map toJson() => {
|
Map<String, dynamic> toJson() {
|
||||||
"id": id,
|
final Map<String, dynamic> map = <String, dynamic>{
|
||||||
"category_id": categoryId,
|
'id': id,
|
||||||
"name": name,
|
'category_id': categoryId,
|
||||||
"ean": ean,
|
'name': name,
|
||||||
"articul": articul,
|
'ean': ean,
|
||||||
"price": price,
|
'articul': articul,
|
||||||
"opt_price": optPrice,
|
'price': price,
|
||||||
"base_price": basePrice,
|
'opt_price': optPrice,
|
||||||
"divisible": divisible,
|
'base_price': basePrice,
|
||||||
"updated_at": updatedAt,
|
'divisible': divisible,
|
||||||
};
|
'updated_at': updatedAt,
|
||||||
}
|
};
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,21 @@
|
||||||
|
import 'package:satu/core/utils/utils_parse.dart';
|
||||||
|
|
||||||
class ProductDao {
|
class ProductDao {
|
||||||
|
ProductDao();
|
||||||
|
|
||||||
|
ProductDao.fromMap(dynamic map) {
|
||||||
|
id = map['id'] as int;
|
||||||
|
categoryId = map['categoryId'] as int;
|
||||||
|
count = map['count'] as num;
|
||||||
|
price = map['price'] as num;
|
||||||
|
productName = cast<String>(map['productName']) ?? '';
|
||||||
|
categoryName = cast<String>(map['categoryName']);
|
||||||
|
eanCode = cast<String>(map['eanCode']);
|
||||||
|
article = map['article'] as int;
|
||||||
|
excise = cast<String>(map['excise']);
|
||||||
|
transactionId = cast<int>(map['transactionId']);
|
||||||
|
}
|
||||||
|
|
||||||
int? id;
|
int? id;
|
||||||
int? categoryId;
|
int? categoryId;
|
||||||
num? count;
|
num? count;
|
||||||
|
|
@ -10,9 +27,8 @@ class ProductDao {
|
||||||
String? excise;
|
String? excise;
|
||||||
int? transactionId;
|
int? transactionId;
|
||||||
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
var map = <String, dynamic>{
|
final Map<String, dynamic> map = <String, dynamic>{
|
||||||
'id': id,
|
'id': id,
|
||||||
'categoryId': categoryId,
|
'categoryId': categoryId,
|
||||||
'count': count,
|
'count': count,
|
||||||
|
|
@ -22,24 +38,8 @@ class ProductDao {
|
||||||
'eanCode': eanCode,
|
'eanCode': eanCode,
|
||||||
'article': article,
|
'article': article,
|
||||||
'excise': excise,
|
'excise': excise,
|
||||||
'transactionId' : transactionId,
|
'transactionId': transactionId,
|
||||||
};
|
};
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ProductDao();
|
|
||||||
|
|
||||||
ProductDao.fromMap(Map<String, dynamic> map) {
|
|
||||||
id = map['id'];
|
|
||||||
categoryId = map['categoryId'];
|
|
||||||
count = map['count'];
|
|
||||||
price = map['price'];
|
|
||||||
productName = map['productName'];
|
|
||||||
categoryName = map['categoryName'];
|
|
||||||
eanCode = map['eanCode'];
|
|
||||||
article = map['article'];
|
|
||||||
excise = map['excise'];
|
|
||||||
transactionId = map['transactionId'];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
class TransactionState {
|
class TransactionState {
|
||||||
String? uuid;
|
String? uuid;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'package:satu/core/utils/utils_parse.dart';
|
||||||
|
|
||||||
/// list : []
|
/// list : []
|
||||||
/// message : ""
|
/// message : ""
|
||||||
/// operation : true
|
/// operation : true
|
||||||
|
|
@ -9,21 +11,22 @@ class Response {
|
||||||
|
|
||||||
Response();
|
Response();
|
||||||
|
|
||||||
factory Response.fromMapList(Map<String, dynamic> map, Function? parser) {
|
factory Response.fromMapList(dynamic map, Function(dynamic)? parser) {
|
||||||
|
|
||||||
List list = [];
|
final List list = [];
|
||||||
if (map['list'] != null) {
|
if (map['list'] != null) {
|
||||||
(map['list'] as List).forEach((element) {
|
(map['list'] as List).forEach((dynamic element) {
|
||||||
if(parser == null)
|
if(parser == null) {
|
||||||
list.add(element);
|
list.add(element);
|
||||||
else
|
} else {
|
||||||
list.add(parser(element));
|
list.add(parser(element));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Response responseBean = Response();
|
final Response responseBean = Response();
|
||||||
responseBean.list = list;
|
responseBean.list = list;
|
||||||
responseBean.message = map['message'];
|
responseBean.message = cast<String>(map['message']);
|
||||||
responseBean.operation = map['operation'];
|
responseBean.operation = map['operation'] as bool;
|
||||||
return responseBean;
|
return responseBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@ import 'package:logger/logger.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:redux/redux.dart';
|
import 'package:redux/redux.dart';
|
||||||
import 'package:redux_thunk/redux_thunk.dart';
|
import 'package:redux_thunk/redux_thunk.dart';
|
||||||
import 'package:satu/core/entity/Category.dart';
|
import 'package:satu/core/entity/category_entity.dart';
|
||||||
import 'package:satu/core/entity/Goods.dart';
|
import 'package:satu/core/entity/goods_entity.dart';
|
||||||
import 'package:satu/core/entity/Transaction.dart';
|
import 'package:satu/core/entity/transaction_entity.dart';
|
||||||
import 'package:satu/core/models/flow/product_dao.dart';
|
import 'package:satu/core/models/flow/product_dao.dart';
|
||||||
import 'package:satu/core/models/flow/transaction_state.dart';
|
import 'package:satu/core/models/flow/transaction_state.dart';
|
||||||
import 'package:satu/core/redux/state/sell_state.dart';
|
import 'package:satu/core/redux/state/sell_state.dart';
|
||||||
|
|
@ -38,10 +38,10 @@ ThunkAction<AppState> counterSellItem({required int transactionId, required num
|
||||||
|
|
||||||
if (uuid != null ) {
|
if (uuid != null ) {
|
||||||
List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere(
|
List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere(
|
||||||
TransactionTableName,
|
transactionTableName,
|
||||||
'$TransactionColumnAppCompanyId = ? and $TransactionColumnStatus = ? and ${TransactionColumnType} = ? and ${TransactionColumnId} = ?',
|
'$transactionColumnAppCompanyId = ? and $transactionColumnStatus = ? and ${transactionColumnType} = ? and ${transactionColumnId} = ?',
|
||||||
[appCompanyId, TransactionStatusPrepare, TransactionTypeSell, transactionId],
|
[appCompanyId, transactionStatusPrepare, transactionTypeSell, transactionId],
|
||||||
orderBy: '$TransactionColumnCreatedAt desc');
|
orderBy: '$transactionColumnCreatedAt desc');
|
||||||
if (set.isNotEmpty) {
|
if (set.isNotEmpty) {
|
||||||
transaction = Transaction.fromMap(set.first);
|
transaction = Transaction.fromMap(set.first);
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +50,7 @@ ThunkAction<AppState> counterSellItem({required int transactionId, required num
|
||||||
ProductDao item = ProductDao.fromMap(jsonDecode(transaction.data!));
|
ProductDao item = ProductDao.fromMap(jsonDecode(transaction.data!));
|
||||||
item.count = (item.count ?? 0) + counter;
|
item.count = (item.count ?? 0) + counter;
|
||||||
transaction.data = jsonEncode(item.toMap());
|
transaction.data = jsonEncode(item.toMap());
|
||||||
_dbService.update(TransactionTableName, transaction.toMap());
|
_dbService.update(transactionTableName, transaction.toMap());
|
||||||
}
|
}
|
||||||
// refresh from db ? after save data
|
// refresh from db ? after save data
|
||||||
await loadSellData(store);
|
await loadSellData(store);
|
||||||
|
|
@ -67,10 +67,10 @@ ThunkAction<AppState> addSellItem({required Good good, String? excise}) {
|
||||||
|
|
||||||
if (uuid != null ) {
|
if (uuid != null ) {
|
||||||
List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere(
|
List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere(
|
||||||
TransactionTableName,
|
transactionTableName,
|
||||||
'$TransactionColumnAppCompanyId = ? and $TransactionColumnStatus = ? and ${TransactionColumnType} = ?',
|
'$transactionColumnAppCompanyId = ? and $transactionColumnStatus = ? and ${transactionColumnType} = ?',
|
||||||
[appCompanyId, TransactionStatusPrepare, TransactionTypeSell],
|
[appCompanyId, transactionStatusPrepare, transactionTypeSell],
|
||||||
orderBy: '$TransactionColumnCreatedAt desc');
|
orderBy: '$transactionColumnCreatedAt desc');
|
||||||
if (set.isNotEmpty) {
|
if (set.isNotEmpty) {
|
||||||
for (Map<String, dynamic> map in set) {
|
for (Map<String, dynamic> map in set) {
|
||||||
Transaction _transaction = Transaction.fromMap(map);
|
Transaction _transaction = Transaction.fromMap(map);
|
||||||
|
|
@ -88,7 +88,7 @@ ThunkAction<AppState> addSellItem({required Good good, String? excise}) {
|
||||||
item..count = item.count! + 1;
|
item..count = item.count! + 1;
|
||||||
transaction.data = jsonEncode(item.toMap());
|
transaction.data = jsonEncode(item.toMap());
|
||||||
transaction.createdAt = DateTime.now().toIso8601String();
|
transaction.createdAt = DateTime.now().toIso8601String();
|
||||||
_dbService.update(TransactionTableName, transaction.toMap());
|
_dbService.update(transactionTableName, transaction.toMap());
|
||||||
} else {
|
} else {
|
||||||
ProductDao item = new ProductDao()
|
ProductDao item = new ProductDao()
|
||||||
..id = good.id
|
..id = good.id
|
||||||
|
|
@ -101,7 +101,7 @@ ThunkAction<AppState> addSellItem({required Good good, String? excise}) {
|
||||||
//category add logic
|
//category add logic
|
||||||
if (good.categoryId != null) {
|
if (good.categoryId != null) {
|
||||||
List<Map<String, dynamic>> set =
|
List<Map<String, dynamic>> set =
|
||||||
await _dbService.queryRowsWithWhere(CategoryTableName, 'id = ?', [good.categoryId]);
|
await _dbService.queryRowsWithWhere(categoryTableName, 'id = ?', [good.categoryId]);
|
||||||
if (set.isNotEmpty) {
|
if (set.isNotEmpty) {
|
||||||
Category category = Category.fromMap(set.first);
|
Category category = Category.fromMap(set.first);
|
||||||
item.categoryId = category.id;
|
item.categoryId = category.id;
|
||||||
|
|
@ -117,12 +117,12 @@ ThunkAction<AppState> addSellItem({required Good good, String? excise}) {
|
||||||
|
|
||||||
transaction = new Transaction()
|
transaction = new Transaction()
|
||||||
..uuid = uuid
|
..uuid = uuid
|
||||||
..status = TransactionStatusPrepare
|
..status = transactionStatusPrepare
|
||||||
..appCompanyId = appCompanyId
|
..appCompanyId = appCompanyId
|
||||||
..type = TransactionTypeSell
|
..type = transactionTypeSell
|
||||||
..createdAt = DateTime.now().toIso8601String()
|
..createdAt = DateTime.now().toIso8601String()
|
||||||
..data = jsonEncode(item.toMap());
|
..data = jsonEncode(item.toMap());
|
||||||
await _dbService.insert(TransactionTableName, transaction.toMap());
|
await _dbService.insert(transactionTableName, transaction.toMap());
|
||||||
}
|
}
|
||||||
// refresh from db ? after save data
|
// refresh from db ? after save data
|
||||||
await loadSellData(store);
|
await loadSellData(store);
|
||||||
|
|
@ -135,7 +135,7 @@ ThunkAction<AppState> removeSellItem({required int transactionId}) {
|
||||||
int? appCompanyId = store.state.userState!.auth!.companyId;
|
int? appCompanyId = store.state.userState!.auth!.companyId;
|
||||||
String? uuid = store.state.sellState!.transactionState!.uuid;
|
String? uuid = store.state.sellState!.transactionState!.uuid;
|
||||||
|
|
||||||
int count = await _dbService.delete(TransactionTableName, transactionId);
|
int count = await _dbService.delete(transactionTableName, transactionId);
|
||||||
log.i('removeSellItem ${count} by transactionId:${transactionId}');
|
log.i('removeSellItem ${count} by transactionId:${transactionId}');
|
||||||
|
|
||||||
// refresh from db ? after save data
|
// refresh from db ? after save data
|
||||||
|
|
@ -149,12 +149,12 @@ Future<void> removeAllSellData(Store<AppState> store) async {
|
||||||
int? appCompanyId = store.state.userState!.auth!.companyId;
|
int? appCompanyId = store.state.userState!.auth!.companyId;
|
||||||
String? uuid = store.state.sellState!.transactionState!.uuid;
|
String? uuid = store.state.sellState!.transactionState!.uuid;
|
||||||
await _dbService.deleteByWhere(
|
await _dbService.deleteByWhere(
|
||||||
TransactionTableName,
|
transactionTableName,
|
||||||
'$TransactionColumnAppCompanyId = ? '
|
'$transactionColumnAppCompanyId = ? '
|
||||||
' and $TransactionColumnStatus = ? '
|
' and $transactionColumnStatus = ? '
|
||||||
' and ${TransactionColumnType} = ?'
|
' and ${transactionColumnType} = ?'
|
||||||
' and ${TransactionColumnUuid} = ?',
|
' and ${transactionColumnUuid} = ?',
|
||||||
[appCompanyId, TransactionStatusPrepare, TransactionTypeSell, uuid]);
|
[appCompanyId, transactionStatusPrepare, transactionTypeSell, uuid]);
|
||||||
await loadSellData(store);
|
await loadSellData(store);
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
log.e('removeAllSellData', e, stack);
|
log.e('removeAllSellData', e, stack);
|
||||||
|
|
@ -166,10 +166,10 @@ Future<void> loadSellData(Store<AppState> store) async {
|
||||||
log.i('loadSellData');
|
log.i('loadSellData');
|
||||||
int? appCompanyId = store.state.userState!.auth!.companyId;
|
int? appCompanyId = store.state.userState!.auth!.companyId;
|
||||||
List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere(
|
List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere(
|
||||||
TransactionTableName,
|
transactionTableName,
|
||||||
'$TransactionColumnAppCompanyId = ? and $TransactionColumnStatus = ? and ${TransactionColumnType} = ?',
|
'$transactionColumnAppCompanyId = ? and $transactionColumnStatus = ? and ${transactionColumnType} = ?',
|
||||||
[appCompanyId, TransactionStatusPrepare, TransactionTypeSell],
|
[appCompanyId, transactionStatusPrepare, transactionTypeSell],
|
||||||
orderBy: '$TransactionColumnCreatedAt desc');
|
orderBy: '$transactionColumnCreatedAt desc');
|
||||||
List<ProductDao> list = [];
|
List<ProductDao> list = [];
|
||||||
String? uuid;
|
String? uuid;
|
||||||
for (Map<String, dynamic> map in set) {
|
for (Map<String, dynamic> map in set) {
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ import 'package:satu/core/redux/actions/user_actions.dart';
|
||||||
import 'package:satu/core/redux/state/nav_state.dart';
|
import 'package:satu/core/redux/state/nav_state.dart';
|
||||||
import 'package:satu/core/redux/state/user_state.dart';
|
import 'package:satu/core/redux/state/user_state.dart';
|
||||||
|
|
||||||
navReducer(NavState prevState, SetNavStateAction action) {
|
NavState navReducer(NavState prevState, SetNavStateAction action) {
|
||||||
final NavState? payload = action.navState;
|
final NavState payload = action.navState;
|
||||||
return prevState.copyWith(
|
return prevState.copyWith(
|
||||||
drawerViewClass: payload?.drawerViewClass!,
|
drawerViewClass: payload.drawerViewClass,
|
||||||
selectedTabIndex: payload?.selectedTabIndex!,
|
selectedTabIndex: payload.selectedTabIndex,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ import 'package:satu/core/redux/actions/user_actions.dart';
|
||||||
import 'package:satu/core/redux/state/sell_state.dart';
|
import 'package:satu/core/redux/state/sell_state.dart';
|
||||||
import 'package:satu/core/redux/state/user_state.dart';
|
import 'package:satu/core/redux/state/user_state.dart';
|
||||||
|
|
||||||
sellReducer(SellState prevState, SetSellStateAction action) {
|
SellState sellReducer(SellState prevState, SetSellStateAction action) {
|
||||||
final payload = action.sellState;
|
final SellState payload = action.sellState;
|
||||||
return prevState.copyWith(
|
return prevState.copyWith(
|
||||||
items: payload.items,
|
items: payload.items,
|
||||||
transactionState: payload.transactionState
|
transactionState: payload.transactionState
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import 'package:satu/core/redux/actions/user_actions.dart';
|
import 'package:satu/core/redux/actions/user_actions.dart';
|
||||||
import 'package:satu/core/redux/state/user_state.dart';
|
import 'package:satu/core/redux/state/user_state.dart';
|
||||||
|
|
||||||
userReducer(UserState prevState, SetUserStateAction action) {
|
UserState userReducer(UserState prevState, SetUserStateAction action) {
|
||||||
final payload = action.userState;
|
final UserState payload = action.userState;
|
||||||
return prevState.copyWith(
|
return prevState.copyWith(
|
||||||
isError: payload.isError,
|
isError: payload.isError,
|
||||||
isLoading: payload.isLoading,
|
isLoading: payload.isLoading,
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,15 @@ import 'actions/user_actions.dart';
|
||||||
AppState appReducer(AppState state, dynamic action) {
|
AppState appReducer(AppState state, dynamic action) {
|
||||||
if (action is SetUserStateAction) {
|
if (action is SetUserStateAction) {
|
||||||
/** UserAction **/
|
/** UserAction **/
|
||||||
final nextState = userReducer(state.userState!, action);
|
final UserState nextState = userReducer(state.userState!, action);
|
||||||
return state.copyWith(userState: nextState);
|
return state.copyWith(userState: nextState);
|
||||||
} else if (action is SetNavStateAction) {
|
} else if (action is SetNavStateAction) {
|
||||||
/** NavAction **/
|
/** NavAction **/
|
||||||
final nextState = navReducer(state.navState!, action);
|
final NavState nextState = navReducer(state.navState!, action);
|
||||||
return state.copyWith(navState: nextState);
|
return state.copyWith(navState: nextState);
|
||||||
} else if (action is SetSellStateAction) {
|
} else if (action is SetSellStateAction) {
|
||||||
/** NavAction **/
|
/** NavAction **/
|
||||||
final nextState = sellReducer(state.sellState!, action);
|
final SellState nextState = sellReducer(state.sellState!, action);
|
||||||
return state.copyWith(sellState: nextState);
|
return state.copyWith(sellState: nextState);
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
|
|
@ -42,7 +42,7 @@ class AppState {
|
||||||
final SellState? sellState;
|
final SellState? sellState;
|
||||||
|
|
||||||
|
|
||||||
AppState({
|
const AppState({
|
||||||
this.userState,
|
this.userState,
|
||||||
this.navState,
|
this.navState,
|
||||||
this.sellState
|
this.sellState
|
||||||
|
|
|
||||||
|
|
@ -11,37 +11,33 @@ class ApiService extends BaseService {
|
||||||
static const host = 'satu.aman.com.kz';
|
static const host = 'satu.aman.com.kz';
|
||||||
static const endpoint = '/api/v1';
|
static const endpoint = '/api/v1';
|
||||||
|
|
||||||
var client = new http.Client();
|
http.Client client = http.Client();
|
||||||
|
|
||||||
//TOKEN
|
//TOKEN
|
||||||
String? _token;
|
String? token;
|
||||||
|
|
||||||
String? get token => this._token;
|
|
||||||
|
|
||||||
set token(String? value) => this._token = value;
|
|
||||||
|
|
||||||
Future<String> _get(String point, {Map<String, String>? requestBody, Map<String, String>? header}) async {
|
Future<String> _get(String point, {Map<String, String>? requestBody, Map<String, String>? header}) async {
|
||||||
Map<String, String> headers = <String, String>{
|
final Map<String, String> headers = <String, String>{
|
||||||
HttpHeaders.contentTypeHeader: "application/json",
|
HttpHeaders.contentTypeHeader: "application/json",
|
||||||
HttpHeaders.cacheControlHeader: "no-cache"
|
HttpHeaders.cacheControlHeader: "no-cache"
|
||||||
};
|
};
|
||||||
if (header != null && header.isNotEmpty) {
|
if (header != null && header.isNotEmpty) {
|
||||||
headers.addAll(header);
|
headers.addAll(header);
|
||||||
}
|
}
|
||||||
String url = '$endpoint$point';
|
final String url = '$endpoint$point';
|
||||||
final response = await http.get(Uri.https(host, url), headers: headers);
|
final response = await http.get(Uri.https(host, url), headers: headers);
|
||||||
return response.body;
|
return response.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> _post(String point, {Map<String, dynamic>? requestBody, Map<String, String>? header}) async {
|
Future<String> _post(String point, {Map<String, dynamic>? requestBody, Map<String, String>? header}) async {
|
||||||
Map<String, String> headers = <String, String>{
|
final Map<String, String> headers = <String, String>{
|
||||||
HttpHeaders.contentTypeHeader: "application/json",
|
HttpHeaders.contentTypeHeader: "application/json",
|
||||||
HttpHeaders.cacheControlHeader: "no-cache"
|
HttpHeaders.cacheControlHeader: "no-cache"
|
||||||
};
|
};
|
||||||
if (header != null && header.isNotEmpty) {
|
if (header != null && header.isNotEmpty) {
|
||||||
headers.addAll(header);
|
headers.addAll(header);
|
||||||
}
|
}
|
||||||
String url = '$endpoint$point';
|
final String url = '$endpoint$point';
|
||||||
if(requestBody!=null) {
|
if(requestBody!=null) {
|
||||||
log.i(jsonEncode(requestBody));
|
log.i(jsonEncode(requestBody));
|
||||||
}
|
}
|
||||||
|
|
@ -51,14 +47,14 @@ class ApiService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<AuthResponse> login(String username, String password) async {
|
Future<AuthResponse> login(String username, String password) async {
|
||||||
Map<String, String> requestBody = <String, String>{'username': username, 'password': password};
|
final Map<String, String> requestBody = <String, String>{'username': username, 'password': password};
|
||||||
AuthResponse result;
|
AuthResponse result;
|
||||||
try {
|
try {
|
||||||
String response = await _post('/login', requestBody: requestBody);
|
final String response = await _post('/login', requestBody: requestBody);
|
||||||
result = AuthResponse.fromMap(json.decode(response))!;
|
result = AuthResponse.fromMap(json.decode(response));
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
log.e("login", e, stack);
|
log.e("login", e, stack);
|
||||||
result = new AuthResponse()
|
result = AuthResponse()
|
||||||
..message = 'Ошибка вызова сервера'
|
..message = 'Ошибка вызова сервера'
|
||||||
..operation = false;
|
..operation = false;
|
||||||
}
|
}
|
||||||
|
|
@ -66,14 +62,14 @@ class ApiService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<AuthResponse> authorization(String token) async {
|
Future<AuthResponse> authorization(String token) async {
|
||||||
Map<String, String> requestBody = <String, String>{'token': token};
|
final Map<String, String> requestBody = <String, String>{'token': token};
|
||||||
AuthResponse result;
|
AuthResponse result;
|
||||||
try {
|
try {
|
||||||
String response = await _post('/authorization', requestBody: requestBody);
|
final String response = await _post('/authorization', requestBody: requestBody);
|
||||||
result = AuthResponse.fromMap(json.decode(response))!;
|
result = AuthResponse.fromMap(json.decode(response));
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
log.e("authorization", e, stack);
|
log.e("authorization", e, stack);
|
||||||
result = new AuthResponse()
|
result = AuthResponse()
|
||||||
..message = 'Ошибка вызова сервера'
|
..message = 'Ошибка вызова сервера'
|
||||||
..operation = false;
|
..operation = false;
|
||||||
}
|
}
|
||||||
|
|
@ -81,14 +77,14 @@ class ApiService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<AuthResponse> auth(String token) async {
|
Future<AuthResponse> auth(String token) async {
|
||||||
Map<String, String> headers = <String, String>{HttpHeaders.authorizationHeader: 'Bearer $token'};
|
final Map<String, String> headers = <String, String>{HttpHeaders.authorizationHeader: 'Bearer $token'};
|
||||||
AuthResponse result;
|
AuthResponse result;
|
||||||
try {
|
try {
|
||||||
String response = await _post('/auth', header: headers);
|
final String response = await _post('/auth', header: headers);
|
||||||
result = AuthResponse.fromMap(json.decode(response))!;
|
result = AuthResponse.fromMap(json.decode(response));
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
log.e("auth", e, stack);
|
log.e("auth", e, stack);
|
||||||
result = new AuthResponse()
|
result = AuthResponse()
|
||||||
..message = 'Ошибка вызова сервера'
|
..message = 'Ошибка вызова сервера'
|
||||||
..operation = false;
|
..operation = false;
|
||||||
}
|
}
|
||||||
|
|
@ -96,14 +92,14 @@ class ApiService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<AuthResponse> logout() async {
|
Future<AuthResponse> logout() async {
|
||||||
Map<String, String> headers = <String, String>{HttpHeaders.authorizationHeader: 'Bearer $token'};
|
final Map<String, String> headers = <String, String>{HttpHeaders.authorizationHeader: 'Bearer $token'};
|
||||||
AuthResponse result;
|
AuthResponse result;
|
||||||
try {
|
try {
|
||||||
String response = await _post('/logout', header: headers);
|
final String response = await _post('/logout', header: headers);
|
||||||
result = AuthResponse.fromMap(json.decode(response))!;
|
result = AuthResponse.fromMap(json.decode(response));
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
log.e("auth", e, stack);
|
log.e("auth", e, stack);
|
||||||
result = new AuthResponse()
|
result = AuthResponse()
|
||||||
..message = 'Ошибка вызова сервера'
|
..message = 'Ошибка вызова сервера'
|
||||||
..operation = false;
|
..operation = false;
|
||||||
}
|
}
|
||||||
|
|
@ -113,12 +109,12 @@ class ApiService extends BaseService {
|
||||||
Future<Response> dictionaries(String target) async {
|
Future<Response> dictionaries(String target) async {
|
||||||
Response result;
|
Response result;
|
||||||
try {
|
try {
|
||||||
Map<String, String> headers = <String, String>{HttpHeaders.authorizationHeader: 'Bearer $token'};
|
final Map<String, String> headers = <String, String>{HttpHeaders.authorizationHeader: 'Bearer $token'};
|
||||||
String response = await _post(target, header: headers);
|
final String response = await _post(target, header: headers);
|
||||||
result = Response.fromMapList(json.decode(response), null);
|
result = Response.fromMapList(json.decode(response), null);
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
log.e("dictionaries", e, stack);
|
log.e("dictionaries", e, stack);
|
||||||
result = new Response()..operation=false..list=[];
|
result = Response()..operation=false..list=[];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:satu/core/base/base_service.dart';
|
import 'package:satu/core/base/base_service.dart';
|
||||||
import 'package:satu/core/entity/Category.dart';
|
import 'package:satu/core/entity/category_entity.dart';
|
||||||
import 'package:satu/core/entity/Goods.dart';
|
import 'package:satu/core/entity/goods_entity.dart';
|
||||||
import 'package:satu/core/entity/Transaction.dart';
|
import 'package:satu/core/entity/transaction_entity.dart';
|
||||||
import 'package:sqflite/sqflite.dart';
|
import 'package:sqflite/sqflite.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
|
||||||
class DbService extends BaseService {
|
class DbService extends BaseService {
|
||||||
static final _databaseName = "AmanSatuDb.db";
|
static const _databaseName = "AmanSatuDb.db";
|
||||||
static final _databaseVersion = 1;
|
static const _databaseVersion = 1;
|
||||||
|
|
||||||
// make this a singleton class
|
// make this a singleton class
|
||||||
DbService._privateConstructor();
|
DbService._privateConstructor();
|
||||||
|
|
@ -20,26 +20,24 @@ class DbService extends BaseService {
|
||||||
// only have a single app-wide reference to the database
|
// only have a single app-wide reference to the database
|
||||||
static Database? _database;
|
static Database? _database;
|
||||||
|
|
||||||
Future<Database?> get database async {
|
Future<Database> get database async {
|
||||||
if (_database != null) return _database;
|
return _database ?? await _initDatabase();
|
||||||
// lazily instantiate the db the first time it is accessed
|
|
||||||
_database = await _initDatabase();
|
|
||||||
return _database;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this opens the database (and creates it if it doesn't exist)
|
// this opens the database (and creates it if it doesn't exist)
|
||||||
_initDatabase() async {
|
Future<Database> _initDatabase() async {
|
||||||
Directory documentsDirectory = await getApplicationDocumentsDirectory();
|
final Directory documentsDirectory = await getApplicationDocumentsDirectory();
|
||||||
String path = join(documentsDirectory.path, _databaseName);
|
final String path = join(documentsDirectory.path, _databaseName);
|
||||||
return await openDatabase(path,
|
final Database db = await openDatabase(path,
|
||||||
version: _databaseVersion, onUpgrade: _onUpdate, onCreate: _onCreate);
|
version: _databaseVersion, onUpgrade: _onUpdate, onCreate: _onCreate);
|
||||||
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _onUpdate(Database db, int oldVersion, int newVersion) async {
|
Future _onUpdate(Database db, int oldVersion, int newVersion) async {
|
||||||
log.i('update from $oldVersion to $newVersion');
|
log.i('update from $oldVersion to $newVersion');
|
||||||
//Goods table
|
//Goods table
|
||||||
await db.execute('DROP TABLE IF EXISTS $GoodTableName;');
|
await db.execute('DROP TABLE IF EXISTS $goodTableName;');
|
||||||
await db.execute('DROP TABLE IF EXISTS $CategoryTableName;');
|
await db.execute('DROP TABLE IF EXISTS $categoryTableName;');
|
||||||
//await db.execute('DROP TABLE IF EXISTS $Voucher_tableName;');
|
//await db.execute('DROP TABLE IF EXISTS $Voucher_tableName;');
|
||||||
log.i('dropped tables');
|
log.i('dropped tables');
|
||||||
_onCreate(db, newVersion);
|
_onCreate(db, newVersion);
|
||||||
|
|
@ -49,7 +47,7 @@ class DbService extends BaseService {
|
||||||
log.i('create tables');
|
log.i('create tables');
|
||||||
//Goods table
|
//Goods table
|
||||||
await db.execute('''
|
await db.execute('''
|
||||||
CREATE TABLE IF NOT EXISTS $GoodTableName (
|
CREATE TABLE IF NOT EXISTS $goodTableName (
|
||||||
$GoodColumnId integer primary key unique,
|
$GoodColumnId integer primary key unique,
|
||||||
$GoodColumnArticul integer not null,
|
$GoodColumnArticul integer not null,
|
||||||
$GoodColumnName text not null,
|
$GoodColumnName text not null,
|
||||||
|
|
@ -64,23 +62,23 @@ class DbService extends BaseService {
|
||||||
);
|
);
|
||||||
''');
|
''');
|
||||||
await db.execute('''
|
await db.execute('''
|
||||||
CREATE TABLE IF NOT EXISTS $CategoryTableName (
|
CREATE TABLE IF NOT EXISTS $categoryTableName (
|
||||||
$CategoryColumnId integer primary key unique,
|
$categoryColumnId integer primary key unique,
|
||||||
$CategoryColumnName text not null,
|
$categoryColumnName text not null,
|
||||||
$CategoryColumnParentIn integer,
|
$categoryColumnParentIn integer,
|
||||||
$CategoryColumnAppCompanyId integer,
|
$categoryColumnAppCompanyId integer,
|
||||||
$CategoryColumnUpdatedAt text not null
|
$categoryColumnUpdatedAt text not null
|
||||||
);
|
);
|
||||||
''');
|
''');
|
||||||
await db.execute('''
|
await db.execute('''
|
||||||
CREATE TABLE IF NOT EXISTS $TransactionTableName (
|
CREATE TABLE IF NOT EXISTS $transactionTableName (
|
||||||
$TransactionColumnId integer primary key autoincrement,
|
$transactionColumnId integer primary key autoincrement,
|
||||||
$TransactionColumnUuid text,
|
$transactionColumnUuid text,
|
||||||
$TransactionColumnType integer not null,
|
$transactionColumnType integer not null,
|
||||||
$TransactionColumnAppCompanyId integer not null,
|
$transactionColumnAppCompanyId integer not null,
|
||||||
$TransactionColumnStatus integer not null,
|
$transactionColumnStatus integer not null,
|
||||||
$TransactionColumnData text,
|
$transactionColumnData text,
|
||||||
$TransactionColumnCreatedAt text not null
|
$transactionColumnCreatedAt text not null
|
||||||
);
|
);
|
||||||
''');
|
''');
|
||||||
}
|
}
|
||||||
|
|
@ -89,64 +87,74 @@ class DbService extends BaseService {
|
||||||
// and the value is the column value. The return value is the id of the
|
// and the value is the column value. The return value is the id of the
|
||||||
// inserted row.
|
// inserted row.
|
||||||
Future<int> insert(String table, Map<String, dynamic> row) async {
|
Future<int> insert(String table, Map<String, dynamic> row) async {
|
||||||
Database? db = await instance.database;
|
final Database db = await instance.database;
|
||||||
return await db!.insert(table, row);
|
final int result = await db.insert(table, row);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// All of the rows are returned as a list of maps, where each map is
|
// All of the rows are returned as a list of maps, where each map is
|
||||||
// a key-value list of columns.
|
// a key-value list of columns.
|
||||||
Future<List<Map<String, dynamic>>> queryAllRows(String table) async {
|
Future<List<Map<String, dynamic>>> queryAllRows(String table) async {
|
||||||
Database? db = await instance.database;
|
final Database db = await instance.database;
|
||||||
return await db!.query(table);
|
final List<Map<String, dynamic>> result = await db.query(table);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Map<String, dynamic>>> queryRaw(String sql, List<dynamic> args) async {
|
Future<List<Map<String, dynamic>>> queryRaw(String sql, List<dynamic> args) async {
|
||||||
Database? db = await instance.database;
|
final Database db = await instance.database;
|
||||||
return await db!.rawQuery(sql, args );
|
final List<Map<String, dynamic>> result = await db.rawQuery(sql, args );
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Map<String, dynamic>>> queryAllRowsOrderBy(String table, String orderBy) async {
|
Future<List<Map<String, dynamic>>> queryAllRowsOrderBy(String table, String orderBy) async {
|
||||||
Database? db = await instance.database;
|
final Database db = await instance.database;
|
||||||
return await db!.query(table, orderBy: orderBy);
|
final List<Map<String, dynamic>> result = await db.query(table, orderBy: orderBy);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Map<String, dynamic>>> queryRowsWithWhere(
|
Future<List<Map<String, dynamic>>> queryRowsWithWhere(
|
||||||
String table, String where, List<dynamic> args, { String? orderBy }) async {
|
String table, String where, List<dynamic> args, { String? orderBy }) async {
|
||||||
Database? db = await instance.database;
|
final Database db = await instance.database;
|
||||||
return await db!.query(table, where: where, whereArgs: args, orderBy: orderBy);
|
final List<Map<String, dynamic>> result = await db.query(table, where: where, whereArgs: args, orderBy: orderBy);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// All of the methods (insert, query, update, delete) can also be done using
|
// All of the methods (insert, query, update, delete) can also be done using
|
||||||
// raw SQL commands. This method uses a raw query to give the row count.
|
// raw SQL commands. This method uses a raw query to give the row count.
|
||||||
Future<int?> queryRowCount(String table) async {
|
Future<int?> queryRowCount(String table) async {
|
||||||
Database? db = await instance.database;
|
final Database db = await instance.database;
|
||||||
return Sqflite.firstIntValue(
|
final int? result = Sqflite.firstIntValue(
|
||||||
await db!.rawQuery('SELECT COUNT(*) FROM $table'));
|
await db.rawQuery('SELECT COUNT(*) FROM $table'));
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We are assuming here that the id column in the map is set. The other
|
// We are assuming here that the id column in the map is set. The other
|
||||||
// column values will be used to update the row.
|
// column values will be used to update the row.
|
||||||
Future<int> update(String table, Map<String, dynamic> row) async {
|
Future<int> update(String table, Map<String, dynamic> row) async {
|
||||||
Database? db = await instance.database;
|
final Database db = await instance.database;
|
||||||
int id = row['id'];
|
final int id = row['id'] as int;
|
||||||
return await db!.update(table, row, where: 'id = ?', whereArgs: [id]);
|
final int result = await db.update(table, row, where: 'id = ?', whereArgs: [id]);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deletes the row specified by the id. The number of affected rows is
|
// Deletes the row specified by the id. The number of affected rows is
|
||||||
// returned. This should be 1 as long as the row exists.
|
// returned. This should be 1 as long as the row exists.
|
||||||
Future<int> delete(String table, int id) async {
|
Future<int> delete(String table, int id) async {
|
||||||
Database? db = await instance.database;
|
final Database db = await instance.database;
|
||||||
return await db!.delete(table, where: 'id = ?', whereArgs: [id]);
|
final int result = await db.delete(table, where: 'id = ?', whereArgs: [id]);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> deleteAll(String table) async {
|
Future<int> deleteAll(String table) async {
|
||||||
Database? db = await instance.database;
|
final Database db = await instance.database;
|
||||||
return await db!.delete(table);
|
final int result = await db.delete(table);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> deleteByWhere(String table, String where, List<dynamic> args) async {
|
Future<int> deleteByWhere(String table, String where, List<dynamic> args) async {
|
||||||
Database? db = await instance.database;
|
final Database db = await instance.database;
|
||||||
return await db!.delete(table, where: where, whereArgs: args);
|
final int result = await db.delete(table, where: where, whereArgs: args);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future close() async => instance.close();
|
Future close() async => instance.close();
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ import 'package:flutter/cupertino.dart';
|
||||||
import 'package:satu/core/models/dialog_models.dart';
|
import 'package:satu/core/models/dialog_models.dart';
|
||||||
|
|
||||||
class DialogService {
|
class DialogService {
|
||||||
GlobalKey<NavigatorState> _dialogNavigationKey = GlobalKey<NavigatorState>();
|
final GlobalKey<NavigatorState> _dialogNavigationKey = GlobalKey<NavigatorState>();
|
||||||
Function(DialogRequest)? _showDialogListener;
|
late Function(DialogRequest)? _showDialogListener;
|
||||||
Function(DialogRequest)? _showDialogInputListener;
|
late Function(DialogRequest)? _showDialogInputListener;
|
||||||
Completer<DialogResponse>? _dialogCompleter;
|
Completer<DialogResponse>? _dialogCompleter;
|
||||||
|
|
||||||
Completer<DialogResponse>? get completer => this._dialogCompleter;
|
Completer<DialogResponse>? get completer => _dialogCompleter;
|
||||||
|
|
||||||
GlobalKey<NavigatorState> get dialogNavigationKey => _dialogNavigationKey;
|
GlobalKey<NavigatorState> get dialogNavigationKey => _dialogNavigationKey;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import 'package:satu/core/base/base_service.dart';
|
import 'package:satu/core/base/base_service.dart';
|
||||||
import 'package:satu/core/entity/Category.dart';
|
import 'package:satu/core/entity/category_entity.dart';
|
||||||
import 'package:satu/core/entity/Goods.dart';
|
import 'package:satu/core/entity/goods_entity.dart';
|
||||||
import 'package:satu/core/models/dictionary/category_response.dart';
|
import 'package:satu/core/models/dictionary/category_response.dart';
|
||||||
import 'package:satu/core/models/dictionary/good_response.dart';
|
import 'package:satu/core/models/dictionary/good_response.dart';
|
||||||
import 'package:satu/core/models/response.dart';
|
import 'package:satu/core/models/response.dart';
|
||||||
|
|
@ -16,16 +16,16 @@ class DictionaryService extends BaseService {
|
||||||
final DbService _db = locator<DbService>();
|
final DbService _db = locator<DbService>();
|
||||||
|
|
||||||
Future<void> refreshFull() async {
|
Future<void> refreshFull() async {
|
||||||
_db.deleteAll(CategoryTableName);
|
_db.deleteAll(categoryTableName);
|
||||||
await refreshCategory();
|
await refreshCategory();
|
||||||
_db.deleteAll(GoodTableName);
|
_db.deleteAll(goodTableName);
|
||||||
await refreshGood();
|
await refreshGood();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> refreshCategory() async {
|
Future<void> refreshCategory() async {
|
||||||
try {
|
try {
|
||||||
int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
final int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
||||||
Response categories = await _api.dictionaries('/categories');
|
final Response categories = await _api.dictionaries('/categories');
|
||||||
if (categories.operation! && categories.list!.isNotEmpty) {
|
if (categories.operation! && categories.list!.isNotEmpty) {
|
||||||
for (dynamic map in categories.list!) {
|
for (dynamic map in categories.list!) {
|
||||||
CategoryResponse cat = CategoryResponse.fromMap(map)!;
|
CategoryResponse cat = CategoryResponse.fromMap(map)!;
|
||||||
|
|
@ -35,7 +35,7 @@ class DictionaryService extends BaseService {
|
||||||
..updatedAt = cat.updatedAt
|
..updatedAt = cat.updatedAt
|
||||||
..parentId = cat.parentId
|
..parentId = cat.parentId
|
||||||
..appCompanyId = appCompanyId;
|
..appCompanyId = appCompanyId;
|
||||||
_db.insert(CategoryTableName, entity.toMap());
|
_db.insert(categoryTableName, entity.toMap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
|
|
@ -44,13 +44,13 @@ class DictionaryService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Category>> getCategoryByParentId(int parentId ) async {
|
Future<List<Category>> getCategoryByParentId(int parentId ) async {
|
||||||
List<Category> list = [];
|
final List<Category> list = [];
|
||||||
try {
|
try {
|
||||||
int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
final int? appCompanyId = Redux.store?.state.userState?.auth?.companyId;
|
||||||
List<Map<String, dynamic>> elements = await _db.queryRowsWithWhere(CategoryTableName, '$CategoryColumnAppCompanyId = ? and $CategoryColumnParentIn = ?', [appCompanyId, parentId]);
|
final List<Map<String, dynamic>> elements = await _db.queryRowsWithWhere(categoryTableName, '$categoryColumnAppCompanyId = ? and $categoryColumnParentIn = ?', [appCompanyId, parentId]);
|
||||||
elements.forEach((element) {
|
for (final Map<String, dynamic> element in elements){
|
||||||
list.add(Category.fromMap(element));
|
list.add(Category.fromMap(element));
|
||||||
});
|
}
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
log.e("getCategoryByParentId", e, stack);
|
log.e("getCategoryByParentId", e, stack);
|
||||||
}
|
}
|
||||||
|
|
@ -58,13 +58,13 @@ class DictionaryService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Good>> getGoodsByCategoryId(int categoryId ) async {
|
Future<List<Good>> getGoodsByCategoryId(int categoryId ) async {
|
||||||
List<Good> list = [];
|
final List<Good> list = [];
|
||||||
try {
|
try {
|
||||||
int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
final int? appCompanyId = Redux.store?.state.userState?.auth?.companyId;
|
||||||
List<Map<String, dynamic>> elements = await _db.queryRowsWithWhere(GoodTableName, '$GoodColumnAppCompanyId = ? and $GoodColumnCategoryId = ?', [appCompanyId, categoryId]);
|
final List<Map<String, dynamic>> elements = await _db.queryRowsWithWhere(goodTableName, '$GoodColumnAppCompanyId = ? and $GoodColumnCategoryId = ?', [appCompanyId, categoryId]);
|
||||||
elements.forEach((element) {
|
for (final Map<String, dynamic> element in elements){
|
||||||
list.add(Good.fromMap(element));
|
list.add(Good.fromMap(element));
|
||||||
});
|
}
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
log.e("getGoodsByCategoryId", e, stack);
|
log.e("getGoodsByCategoryId", e, stack);
|
||||||
}
|
}
|
||||||
|
|
@ -72,19 +72,19 @@ class DictionaryService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Good>> getGoodsByNameOrEan( String query ) async {
|
Future<List<Good>> getGoodsByNameOrEan( String query ) async {
|
||||||
List<Good> list = [];
|
final List<Good> list = [];
|
||||||
try {
|
try {
|
||||||
int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
final int? appCompanyId = Redux.store?.state.userState?.auth?.companyId;
|
||||||
String where = '( $GoodColumnAppCompanyId = ? and $GoodColumnName like ? ) ';
|
String where = '( $GoodColumnAppCompanyId = ? and $GoodColumnName like ? ) ';
|
||||||
List args = [appCompanyId, '%$query%'];
|
final List args = [appCompanyId, '%$query%'];
|
||||||
if(_isNumericInt(query)){
|
if(_isNumericInt(query)){
|
||||||
where += ' or $GoodColumnEan like ?';
|
where += ' or $GoodColumnEan like ?';
|
||||||
args.add('${int.parse(query).toString()}%');
|
args.add('${int.parse(query).toString()}%');
|
||||||
}
|
}
|
||||||
List<Map<String, dynamic>> elements = await _db.queryRowsWithWhere(GoodTableName, where, args);
|
final List<Map<String, dynamic>> elements = await _db.queryRowsWithWhere(goodTableName, where, args);
|
||||||
elements.forEach((element) {
|
for (final Map<String, dynamic> element in elements){
|
||||||
list.add(Good.fromMap(element));
|
list.add(Good.fromMap(element));
|
||||||
});
|
}
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
log.e("getGoodsByCategoryId", e, stack);
|
log.e("getGoodsByCategoryId", e, stack);
|
||||||
}
|
}
|
||||||
|
|
@ -92,15 +92,16 @@ class DictionaryService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Good>> getGoodsByEan( String code ) async {
|
Future<List<Good>> getGoodsByEan( String code ) async {
|
||||||
List<Good> list = [];
|
final List<Good> list = [];
|
||||||
try {
|
try {
|
||||||
int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
final int? appCompanyId = Redux.store?.state.userState?.auth?.companyId;
|
||||||
String where = '( $GoodColumnAppCompanyId = ? and $GoodColumnEan like ? ) ';
|
final String where = '( $GoodColumnAppCompanyId = ? and $GoodColumnEan like ? ) ';
|
||||||
List args = [appCompanyId, '%$code%'];
|
final List args = [appCompanyId, '%$code%'];
|
||||||
List<Map<String, dynamic>> elements = await _db.queryRowsWithWhere(GoodTableName, where, args);
|
final List<Map<String, dynamic>>
|
||||||
elements.forEach((element) {
|
elements = await _db.queryRowsWithWhere(goodTableName, where, args);
|
||||||
|
for (final Map<String, dynamic> element in elements){
|
||||||
list.add(Good.fromMap(element));
|
list.add(Good.fromMap(element));
|
||||||
});
|
}
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
log.e("getGoodsByEan", e, stack);
|
log.e("getGoodsByEan", e, stack);
|
||||||
}
|
}
|
||||||
|
|
@ -119,9 +120,9 @@ class DictionaryService extends BaseService {
|
||||||
int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
||||||
Response categories = await _api.dictionaries('/goods');
|
Response categories = await _api.dictionaries('/goods');
|
||||||
if (categories.operation! && categories.list!.isNotEmpty) {
|
if (categories.operation! && categories.list!.isNotEmpty) {
|
||||||
for (dynamic map in categories.list!) {
|
for (final dynamic map in categories.list!) {
|
||||||
GoodResponse good = GoodResponse.fromMap(map)!;
|
final GoodResponse good = GoodResponse.fromMap(map);
|
||||||
Good entity = new Good()
|
final Good entity = new Good()
|
||||||
..id = good.id
|
..id = good.id
|
||||||
..name = good.name
|
..name = good.name
|
||||||
..categoryId = good.categoryId
|
..categoryId = good.categoryId
|
||||||
|
|
@ -133,7 +134,7 @@ class DictionaryService extends BaseService {
|
||||||
..divisible = good.divisible
|
..divisible = good.divisible
|
||||||
..updatedAt = good.updatedAt
|
..updatedAt = good.updatedAt
|
||||||
..appCompanyId = appCompanyId;
|
..appCompanyId = appCompanyId;
|
||||||
_db.insert(GoodTableName, entity.toMap());
|
_db.insert(goodTableName, entity.toMap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
|
|
|
||||||
|
|
@ -9,24 +9,25 @@ class SimpleLogPrinter extends LogPrinter {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<String> log(LogEvent event) {
|
List<String> log(LogEvent event) {
|
||||||
var level = event.level;
|
final Level level = event.level;
|
||||||
var message = stringifyMessage(event.message);
|
final String message = stringifyMessage(event.message);
|
||||||
var error = event.error?.toString() ?? '';
|
final String error = event.error?.toString() ?? '';
|
||||||
var color = PrettyPrinter.levelColors[level];
|
final color = PrettyPrinter.levelColors[level];
|
||||||
var emoji = PrettyPrinter.levelEmojis[level];
|
final emoji = PrettyPrinter.levelEmojis[level];
|
||||||
String? stack;
|
String? stack;
|
||||||
if (event.stackTrace == null) {
|
if (event.stackTrace == null) {
|
||||||
stack = formatStackTrace(StackTrace.current, 2);
|
stack = formatStackTrace(StackTrace.current, 2);
|
||||||
} else {
|
} else {
|
||||||
stack = formatStackTrace(event.stackTrace!, 1);
|
stack = formatStackTrace(event.stackTrace!, 1);
|
||||||
}
|
}
|
||||||
|
// ignore: avoid_print
|
||||||
print(color!(' $emoji $message $error -> $stack '));
|
print(color!(' $emoji $message $error -> $stack '));
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
String stringifyMessage(dynamic message) {
|
String stringifyMessage(dynamic message) {
|
||||||
if (message is Map || message is Iterable) {
|
if (message is Map || message is Iterable) {
|
||||||
var encoder = JsonEncoder.withIndent(' ');
|
const encoder = JsonEncoder.withIndent(' ');
|
||||||
return encoder.convert(message);
|
return encoder.convert(message);
|
||||||
} else {
|
} else {
|
||||||
return message.toString();
|
return message.toString();
|
||||||
|
|
@ -34,15 +35,15 @@ class SimpleLogPrinter extends LogPrinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
String? formatStackTrace(StackTrace stackTrace, int methodPosition) {
|
String? formatStackTrace(StackTrace stackTrace, int methodPosition) {
|
||||||
var lines = stackTrace.toString().split('\n');
|
final lines = stackTrace.toString().split('\n');
|
||||||
var formatted = <String>[];
|
final formatted = <String>[];
|
||||||
var count = 0;
|
var count = 0;
|
||||||
for (var line in lines) {
|
for (final line in lines) {
|
||||||
if (_discardDeviceStacktraceLine(line) ||
|
if (_discardDeviceStacktraceLine(line) ||
|
||||||
_discardWebStacktraceLine(line)) {
|
_discardWebStacktraceLine(line)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
formatted.add('${line.replaceFirst(RegExp(r'#\d+\s+'), '')}');
|
formatted.add(line.replaceFirst(RegExp(r'#\d+\s+'), ''));
|
||||||
if (++count == methodPosition) {
|
if (++count == methodPosition) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +58,7 @@ class SimpleLogPrinter extends LogPrinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _discardDeviceStacktraceLine(String line) {
|
bool _discardDeviceStacktraceLine(String line) {
|
||||||
var match = _deviceStackTraceRegex.matchAsPrefix(line);
|
final match = _deviceStackTraceRegex.matchAsPrefix(line);
|
||||||
if (match == null) {
|
if (match == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +66,7 @@ class SimpleLogPrinter extends LogPrinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _discardWebStacktraceLine(String line) {
|
bool _discardWebStacktraceLine(String line) {
|
||||||
var match = _webStackTraceRegex.matchAsPrefix(line);
|
final match = _webStackTraceRegex.matchAsPrefix(line);
|
||||||
if (match == null) {
|
if (match == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
List<String>? parseListString(json){
|
|
||||||
if(json==null) return null;
|
|
||||||
return new List<String>.from(json);
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
List<String>? parseListString(Iterable<dynamic>? json){
|
||||||
|
if(json==null) return null;
|
||||||
|
return List<String>.from(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
T? cast<T>(x) => x is T ? x : null;
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:satu/core/entity/Category.dart';
|
import 'package:satu/core/entity/category_entity.dart';
|
||||||
import 'package:satu/core/entity/Goods.dart';
|
import 'package:satu/core/entity/goods_entity.dart';
|
||||||
import 'package:satu/core/redux/actions/sell_actions.dart';
|
import 'package:satu/core/redux/actions/sell_actions.dart';
|
||||||
import 'package:satu/core/redux/store.dart';
|
import 'package:satu/core/redux/store.dart';
|
||||||
import 'package:satu/core/services/dictionary_service.dart';
|
import 'package:satu/core/services/dictionary_service.dart';
|
||||||
|
|
@ -107,14 +107,14 @@ class _AddProductViewState extends State<AddProductView> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onCategoryPress(Category category) {
|
void onCategoryPress(Category category) {
|
||||||
_history!.add(category);
|
_history!.add(category);
|
||||||
navigateCategory(category.id!);
|
navigateCategory(category.id!);
|
||||||
}
|
}
|
||||||
|
|
||||||
onGoodPress(Good good) {
|
void onGoodPress(Good good) {
|
||||||
Redux.store!.dispatch(addSellItem(good: good));
|
Redux.store!.dispatch(addSellItem(good: good));
|
||||||
_navigatorService.pop();
|
_navigatorService.pop<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
|
|
||||||
|
|
@ -99,16 +99,17 @@ class _LoginViewState extends State<LoginView> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_pressBtnEnter() async {
|
Future<void> _pressBtnEnter() async {
|
||||||
Redux.store!.dispatch(authenticate(emailController.text, passwordController.text));
|
Redux.store!.dispatch(authenticate(emailController.text, passwordController.text));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> scan() async {
|
Future<void> scan() async {
|
||||||
|
|
||||||
String? result = await locator<NavigatorService>().push(AddByBarcodeViewRoute);
|
final NavigatorService _nav = locator<NavigatorService>().push(AddByBarcodeViewRoute) as NavigatorService;
|
||||||
|
final dynamic result = await _nav.push(AddByBarcodeViewRoute) ;
|
||||||
if(result != null) {
|
if(result != null) {
|
||||||
if( result.length == 60 ) {
|
if( result.length == 60 ) {
|
||||||
Redux.store?.dispatch(authenticateByToken(result));
|
Redux.store?.dispatch(authenticateByToken(result as String));
|
||||||
} else {
|
} else {
|
||||||
_dialogService.showDialog(description: 'Не верный формат QR кода');
|
_dialogService.showDialog(description: 'Не верный формат QR кода');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
Future dialog(BuildContext cont) async {
|
||||||
|
return showDialog(
|
||||||
|
//barrierDismissible: false,
|
||||||
|
context: cont,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return StatefulBuilder(builder: (context, setState) {
|
||||||
|
return AlertDialog(
|
||||||
|
insetPadding: EdgeInsets.zero,
|
||||||
|
shape: const RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(10.0))),
|
||||||
|
content: SizedBox.expand(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Wrap(
|
||||||
|
children: <Widget>[
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
const Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: Text(
|
||||||
|
"Sample type",
|
||||||
|
style: TextStyle(fontWeight: FontWeight.w700),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(flex: 1, child: Text("123"))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:satu/core/redux/actions/sell_actions.dart';
|
import 'package:satu/core/redux/actions/sell_actions.dart';
|
||||||
import 'package:satu/core/redux/store.dart';
|
import 'package:satu/core/redux/store.dart';
|
||||||
|
import 'package:satu/core/services/dialog_service.dart';
|
||||||
import 'package:satu/core/services/navigator_service.dart';
|
import 'package:satu/core/services/navigator_service.dart';
|
||||||
import 'package:satu/core/utils/locator.dart';
|
import 'package:satu/core/utils/locator.dart';
|
||||||
import 'package:satu/routes/route_names.dart';
|
import 'package:satu/routes/route_names.dart';
|
||||||
|
|
@ -12,6 +13,8 @@ import 'package:satu/shared/ui_helpers.dart';
|
||||||
import 'package:satu/views/add_by_barcode/add_by_barcode_view.dart';
|
import 'package:satu/views/add_by_barcode/add_by_barcode_view.dart';
|
||||||
import 'package:satu/widgets/ui/product_title_widget.dart';
|
import 'package:satu/widgets/ui/product_title_widget.dart';
|
||||||
|
|
||||||
|
import 'dialog_edit_product.dart';
|
||||||
|
|
||||||
class ProductListItem extends StatefulWidget {
|
class ProductListItem extends StatefulWidget {
|
||||||
final String name;
|
final String name;
|
||||||
final String? ean;
|
final String? ean;
|
||||||
|
|
@ -31,10 +34,11 @@ class ProductListItem extends StatefulWidget {
|
||||||
|
|
||||||
class _ProductListItemState extends State<ProductListItem> {
|
class _ProductListItemState extends State<ProductListItem> {
|
||||||
final NavigatorService _navigatorService = locator<NavigatorService>();
|
final NavigatorService _navigatorService = locator<NavigatorService>();
|
||||||
|
final DialogService _dialogService = locator<DialogService>();
|
||||||
|
|
||||||
void _onItemTapped(BuildContext context) {
|
void _onItemTapped(BuildContext context) {
|
||||||
Navigator.of(context).push(new MaterialPageRoute(
|
Navigator.of(context).push(MaterialPageRoute(
|
||||||
builder: (BuildContext context) => new AddByBarcodeView()));
|
builder: (BuildContext context) => AddByBarcodeView()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -43,8 +47,8 @@ class _ProductListItemState extends State<ProductListItem> {
|
||||||
background: Container(
|
background: Container(
|
||||||
alignment: AlignmentDirectional.centerEnd,
|
alignment: AlignmentDirectional.centerEnd,
|
||||||
color: dangerColor,
|
color: dangerColor,
|
||||||
child: Padding(
|
child: const Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: EdgeInsets.all(8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'Удалить',
|
'Удалить',
|
||||||
style: TextStyle(color: whiteColor, fontWeight: FontWeight.w500),
|
style: TextStyle(color: whiteColor, fontWeight: FontWeight.w500),
|
||||||
|
|
@ -71,7 +75,6 @@ class _ProductListItemState extends State<ProductListItem> {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
onDismissed: (direction) {
|
onDismissed: (direction) {
|
||||||
print(direction);
|
|
||||||
Redux.store!.dispatch(removeSellItem(transactionId: this.widget.transactionId!));
|
Redux.store!.dispatch(removeSellItem(transactionId: this.widget.transactionId!));
|
||||||
},
|
},
|
||||||
key: Key(widget.name ),
|
key: Key(widget.name ),
|
||||||
|
|
@ -99,7 +102,6 @@ class _ProductListItemState extends State<ProductListItem> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Material(
|
Material(
|
||||||
|
|
@ -108,7 +110,7 @@ class _ProductListItemState extends State<ProductListItem> {
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Redux.store!
|
Redux.store!
|
||||||
.dispatch(counterSellItem(transactionId: this.widget.transactionId!, counter: 1.0));
|
.dispatch(counterSellItem(transactionId: widget.transactionId!, counter: 1.0));
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|
@ -126,17 +128,24 @@ class _ProductListItemState extends State<ProductListItem> {
|
||||||
Container(
|
Container(
|
||||||
width: 45.w,
|
width: 45.w,
|
||||||
margin: EdgeInsets.symmetric(horizontal: 5.w),
|
margin: EdgeInsets.symmetric(horizontal: 5.w),
|
||||||
padding: EdgeInsets.symmetric(vertical: 6.0.w),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: whiteColor,
|
color: whiteColor,
|
||||||
borderRadius: BorderRadius.circular(ScreenUtil().radius(5)),
|
borderRadius: BorderRadius.circular(ScreenUtil().radius(5)),
|
||||||
boxShadow: [cardShadowBox]),
|
boxShadow: [cardShadowBox]),
|
||||||
child: SizedBox(
|
child: InkWell(
|
||||||
width: 45.w,
|
onTap: (){
|
||||||
child: Text(
|
_dialogService.showConfirmationDialogInput(description: 'asd');
|
||||||
'${widget.count} шт',
|
},
|
||||||
style: TextStyle(fontSize: 8.sp, color: placeholderColor),
|
child: Padding(
|
||||||
textAlign: TextAlign.center,
|
padding: EdgeInsets.symmetric(vertical: 6.0.w),
|
||||||
|
child: SizedBox(
|
||||||
|
width: 45.w,
|
||||||
|
child: Text(
|
||||||
|
'${widget.count} шт',
|
||||||
|
style: TextStyle(fontSize: 8.sp, color: placeholderColor),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@ import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_redux/flutter_redux.dart';
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:satu/core/entity/Goods.dart';
|
import 'package:redux/src/store.dart';
|
||||||
|
import 'package:satu/core/entity/goods_entity.dart';
|
||||||
import 'package:satu/core/models/flow/product_dao.dart';
|
import 'package:satu/core/models/flow/product_dao.dart';
|
||||||
import 'package:satu/core/redux/actions/sell_actions.dart';
|
import 'package:satu/core/redux/actions/sell_actions.dart';
|
||||||
import 'package:satu/core/redux/state/sell_state.dart';
|
import 'package:satu/core/redux/state/sell_state.dart';
|
||||||
|
|
@ -31,25 +32,25 @@ class SellView extends StatelessWidget {
|
||||||
appBar: ProductsAppBar(
|
appBar: ProductsAppBar(
|
||||||
drawerShow: true,
|
drawerShow: true,
|
||||||
title: 'Продажа',
|
title: 'Продажа',
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
childHeight: 60,
|
||||||
child: ProductHeaderBar(
|
child: ProductHeaderBar(
|
||||||
count: state.items!.length,
|
count: state.items!.length,
|
||||||
sum: sumProducts(state.items!),
|
sum: sumProducts(state.items!),
|
||||||
),
|
),
|
||||||
backgroundColor: backgroundColor,
|
|
||||||
childHeight: 60,
|
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
ContragentSelectBar(
|
const ContragentSelectBar(
|
||||||
value: 'Частное лицо',
|
value: 'Частное лицо',
|
||||||
),
|
),
|
||||||
Visibility(child: ProductsTitleBarBar(itemsExist: true, title: 'Товары',), visible: state.items!.isNotEmpty,),
|
Visibility(visible: state.items!.isNotEmpty,child: const ProductsTitleBarBar(itemsExist: true, title: 'Товары',),),
|
||||||
ListView.separated(
|
ListView.separated(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: BouncingScrollPhysics(),
|
physics: const BouncingScrollPhysics(),
|
||||||
itemCount: state.items!.length,
|
itemCount: state.items!.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
ProductDao product = state.items!.elementAt(index);
|
final ProductDao product = state.items!.elementAt(index);
|
||||||
return ProductListItem(
|
return ProductListItem(
|
||||||
key: UniqueKey(),
|
key: UniqueKey(),
|
||||||
ean: product.eanCode,
|
ean: product.eanCode,
|
||||||
|
|
@ -62,7 +63,7 @@ class SellView extends StatelessWidget {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
separatorBuilder: (context, index) {
|
separatorBuilder: (context, index) {
|
||||||
return Divider(height: 1, color: disableColor,);
|
return const Divider(height: 1, color: disableColor,);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -72,11 +73,11 @@ class SellView extends StatelessWidget {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/// render floating buttons
|
||||||
Widget floatingActionButtonRender() {
|
Widget floatingActionButtonRender() {
|
||||||
return StoreConnector<AppState, SellState>(
|
return StoreConnector<AppState, SellState>(
|
||||||
converter: (store) => store.state.sellState!,
|
converter: (Store<AppState> store) => store.state.sellState!,
|
||||||
builder: (_, snapshot) {
|
builder: (_, SellState snapshot) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.all(15.w),
|
padding: EdgeInsets.all(15.w),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|
@ -86,6 +87,7 @@ class SellView extends StatelessWidget {
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: snapshot.items!.isNotEmpty,
|
visible: snapshot.items!.isNotEmpty,
|
||||||
child: FloatingActionButton(
|
child: FloatingActionButton(
|
||||||
|
mini: true,
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
backgroundColor: successColor,
|
backgroundColor: successColor,
|
||||||
onPressed: () => print('check'),
|
onPressed: () => print('check'),
|
||||||
|
|
@ -96,26 +98,29 @@ class SellView extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
FloatingActionButton(
|
FloatingActionButton(
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
|
mini: true,
|
||||||
onPressed: () => locator<NavigatorService>().push(AddProductViewRoute),
|
onPressed: () => locator<NavigatorService>().push(AddProductViewRoute),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.add_rounded,
|
Icons.add_rounded,
|
||||||
size: 45.sp,
|
size: 40.sp,
|
||||||
color: whiteColor,
|
color: whiteColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
verticalSpaceMedium,
|
verticalSpaceSmall,
|
||||||
FloatingActionButton(
|
FloatingActionButton(
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
|
mini: true,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
String? result = await locator<NavigatorService>().push(AddByBarcodeViewRoute);
|
final NavigatorService _nav = locator<NavigatorService>().push(AddByBarcodeViewRoute) as NavigatorService;
|
||||||
|
final dynamic result = await _nav.push(AddByBarcodeViewRoute) ;
|
||||||
if(result !=null) {
|
if(result !=null) {
|
||||||
List<Good> goods = await locator<DictionaryService>().getGoodsByEan(result);
|
final List<Good> goods = await locator<DictionaryService>().getGoodsByEan(result as String);
|
||||||
if(goods.isNotEmpty) {
|
if(goods.isNotEmpty) {
|
||||||
Redux.store?.dispatch(addSellItem( good: goods.first));
|
Redux.store?.dispatch(addSellItem( good: goods.first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Icon(Icons.qr_code_rounded, size: 35.sp, color: whiteColor),
|
child: Icon(Icons.qr_code_rounded, size: 30.sp, color: whiteColor),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,11 @@ class _DialogManagerState extends State<DialogManager> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showDialog(DialogRequest request) {
|
void _showDialog(DialogRequest request) {
|
||||||
|
|
||||||
var isConfirmationDialog = request.cancelTitle != null;
|
var isConfirmationDialog = request.cancelTitle != null;
|
||||||
showDialog(
|
showDialog<String>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (BuildContext context) => AlertDialog(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(5.0),
|
borderRadius: BorderRadius.circular(5.0),
|
||||||
),
|
),
|
||||||
|
|
@ -49,7 +50,7 @@ class _DialogManagerState extends State<DialogManager> {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
request.title!,
|
request.title!,
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
//Divider(),
|
//Divider(),
|
||||||
],
|
],
|
||||||
|
|
@ -58,18 +59,18 @@ class _DialogManagerState extends State<DialogManager> {
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
if (isConfirmationDialog)
|
if (isConfirmationDialog)
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(request.cancelTitle!),
|
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_dialogService
|
_dialogService
|
||||||
.dialogComplete(DialogResponse(confirmed: false));
|
.dialogComplete(DialogResponse(confirmed: false));
|
||||||
},
|
},
|
||||||
|
child: Text(request.cancelTitle!),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(request.buttonTitle!),
|
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_dialogService
|
_dialogService
|
||||||
.dialogComplete(DialogResponse(confirmed: true));
|
.dialogComplete(DialogResponse(confirmed: true));
|
||||||
},
|
},
|
||||||
|
child: Text(request.buttonTitle!),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class _DialogModalSelectState extends State<DialogModalSelect> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
contentBox(context) {
|
Widget contentBox(BuildContext context) {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
|
|
@ -43,7 +43,7 @@ class _DialogModalSelectState extends State<DialogModalSelect> {
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(padding),
|
borderRadius: BorderRadius.circular(padding),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
const BoxShadow(
|
||||||
color: Colors.black, offset: Offset(0, 10), blurRadius: 10),
|
color: Colors.black, offset: Offset(0, 10), blurRadius: 10),
|
||||||
]),
|
]),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|
|
||||||
17
pubspec.lock
17
pubspec.lock
|
|
@ -176,7 +176,7 @@ packages:
|
||||||
name: get_it
|
name: get_it
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.1.3"
|
version: "7.2.0"
|
||||||
html:
|
html:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -219,6 +219,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.3"
|
version: "0.6.3"
|
||||||
|
lint:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: lint
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.5.3"
|
||||||
logger:
|
logger:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -344,7 +351,7 @@ packages:
|
||||||
name: plugin_platform_interface
|
name: plugin_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.1"
|
||||||
process:
|
process:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -552,7 +559,7 @@ packages:
|
||||||
name: url_launcher
|
name: url_launcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.7"
|
version: "6.0.9"
|
||||||
url_launcher_linux:
|
url_launcher_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -573,7 +580,7 @@ packages:
|
||||||
name: url_launcher_platform_interface
|
name: url_launcher_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.3"
|
version: "2.0.4"
|
||||||
url_launcher_web:
|
url_launcher_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -608,7 +615,7 @@ packages:
|
||||||
name: win32
|
name: win32
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.4"
|
version: "2.2.5"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
14
pubspec.yaml
14
pubspec.yaml
|
|
@ -36,20 +36,20 @@ dependencies:
|
||||||
responsive_builder: ^0.4.1
|
responsive_builder: ^0.4.1
|
||||||
provider: ^5.0.0
|
provider: ^5.0.0
|
||||||
logger: ^1.0.0
|
logger: ^1.0.0
|
||||||
get_it: ^7.1.2
|
get_it: ^7.2.0
|
||||||
equatable: ^2.0.0
|
equatable: ^2.0.3
|
||||||
http: ^0.13.3
|
http: ^0.13.3
|
||||||
sqflite: ^2.0.0+3
|
sqflite: ^2.0.0+3
|
||||||
path_provider: ^2.0.1
|
path_provider: ^2.0.2
|
||||||
material_design_icons_flutter: 5.0.5955-rc.1
|
material_design_icons_flutter: 5.0.5955-rc.1
|
||||||
intl: ^0.17.0
|
intl: ^0.17.0
|
||||||
device_info: ^2.0.0
|
device_info: ^2.0.2
|
||||||
auto_size_text: ^3.0.0-nullsafety.0
|
auto_size_text: ^3.0.0-nullsafety.0
|
||||||
url_launcher: ^6.0.7
|
url_launcher: ^6.0.7
|
||||||
qr_flutter: ^4.0.0
|
qr_flutter: ^4.0.0
|
||||||
mask_text_input_formatter: ^2.0.0
|
mask_text_input_formatter: ^2.0.0
|
||||||
flutter_screenutil: ^5.0.0
|
flutter_screenutil: ^5.0.0+2
|
||||||
shared_preferences: ^2.0.5
|
shared_preferences: ^2.0.6
|
||||||
material_floating_search_bar: ^0.3.4
|
material_floating_search_bar: ^0.3.4
|
||||||
implicitly_animated_reorderable_list: ^0.4.0
|
implicitly_animated_reorderable_list: ^0.4.0
|
||||||
uuid: ^3.0.4
|
uuid: ^3.0.4
|
||||||
|
|
@ -59,6 +59,8 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
lint: ^1.5.3
|
||||||
|
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue