null-safety-migration
parent
b1bd0101a2
commit
036a4e0d87
|
|
@ -3,9 +3,11 @@ import 'package:logger/logger.dart';
|
|||
import '../utils/logger.dart';
|
||||
|
||||
class BaseService {
|
||||
Logger log;
|
||||
Logger log = getLogger(
|
||||
'BaseService',
|
||||
);
|
||||
|
||||
BaseService({String title}) {
|
||||
BaseService({String? title}) {
|
||||
this.log = getLogger(
|
||||
title ?? this.runtimeType.toString(),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ const String CategoryColumnAppCompanyId = 'app_company_id';
|
|||
const String CategoryColumnUpdatedAt = 'updated_at';
|
||||
|
||||
class Category {
|
||||
int id;
|
||||
int parentId;
|
||||
String name;
|
||||
int appCompanyId;
|
||||
String updatedAt;
|
||||
int? id;
|
||||
int? parentId;
|
||||
String? name;
|
||||
int? appCompanyId;
|
||||
String? updatedAt;
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
var map = <String, dynamic>{
|
||||
|
|
|
|||
|
|
@ -12,17 +12,17 @@ const String GoodColumnUpdatedAt = 'updated_at';
|
|||
const String GoodColumnAppCompanyId = 'app_company_id';
|
||||
|
||||
class Good {
|
||||
int id;
|
||||
int categoryId;
|
||||
String name;
|
||||
String ean;
|
||||
int articul;
|
||||
num price;
|
||||
num optPrice;
|
||||
num basePrice;
|
||||
int divisible;
|
||||
String updatedAt;
|
||||
int appCompanyId;
|
||||
int? id;
|
||||
int? categoryId;
|
||||
String? name;
|
||||
String? ean;
|
||||
int? articul;
|
||||
num? price;
|
||||
num? optPrice;
|
||||
num? basePrice;
|
||||
int? divisible;
|
||||
String? updatedAt;
|
||||
int? appCompanyId;
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
var map = <String, dynamic>{
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@ const int TransactionStatusPrepare = 0;
|
|||
|
||||
|
||||
class Transaction {
|
||||
int id;
|
||||
String uuid;
|
||||
int type;
|
||||
int status;
|
||||
String data;
|
||||
int appCompanyId;
|
||||
String createdAt;
|
||||
int? id;
|
||||
String? uuid;
|
||||
int? type;
|
||||
int? status;
|
||||
String? data;
|
||||
int? appCompanyId;
|
||||
String? createdAt;
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
var map = <String, dynamic>{
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@
|
|||
/// operation : true
|
||||
|
||||
class AuthResponse {
|
||||
int userId;
|
||||
int companyId;
|
||||
int kassaId;
|
||||
String token;
|
||||
String authAt;
|
||||
int shard;
|
||||
String message;
|
||||
bool operation;
|
||||
int? userId;
|
||||
int? companyId;
|
||||
int? kassaId;
|
||||
String? token;
|
||||
String? authAt;
|
||||
int? shard;
|
||||
String? message;
|
||||
bool? operation;
|
||||
|
||||
|
||||
static AuthResponse fromMap(Map<String, dynamic> map) {
|
||||
static AuthResponse? fromMap(Map<String, dynamic> map) {
|
||||
if (map == null) return null;
|
||||
AuthResponse authResponseBean = AuthResponse();
|
||||
authResponseBean.userId = map['user_id'];
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class DialogRequest {
|
||||
final String title;
|
||||
final String description;
|
||||
final String buttonTitle;
|
||||
final String cancelTitle;
|
||||
final String formatType;
|
||||
final String? title;
|
||||
final String? description;
|
||||
final String? buttonTitle;
|
||||
final String? cancelTitle;
|
||||
final String? formatType;
|
||||
|
||||
DialogRequest(
|
||||
{@required this.title,
|
||||
|
|
@ -18,8 +18,8 @@ class DialogRequest {
|
|||
class DialogResponse {
|
||||
//final String fieldOne;
|
||||
//final String fieldTwo;
|
||||
final String responseText;
|
||||
final bool confirmed;
|
||||
final String? responseText;
|
||||
final bool? confirmed;
|
||||
|
||||
DialogResponse({
|
||||
//this.fieldOne,
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
/// updated_at : "2021-01-06 14:20:47"
|
||||
|
||||
class CategoryResponse {
|
||||
int id;
|
||||
int parentId;
|
||||
String name;
|
||||
String updatedAt;
|
||||
int? id;
|
||||
int? parentId;
|
||||
String? name;
|
||||
String? updatedAt;
|
||||
|
||||
static CategoryResponse fromMap(Map<String, dynamic> map) {
|
||||
static CategoryResponse? fromMap(Map<String, dynamic> map) {
|
||||
if (map == null) return null;
|
||||
CategoryResponse categoryResponseBean = CategoryResponse();
|
||||
categoryResponseBean.id = map['id'];
|
||||
|
|
|
|||
|
|
@ -10,18 +10,18 @@
|
|||
/// updated_at : "2021-02-03 11:37:34"
|
||||
|
||||
class GoodResponse {
|
||||
int id;
|
||||
int categoryId;
|
||||
String name;
|
||||
String ean;
|
||||
int articul;
|
||||
int price;
|
||||
int optPrice;
|
||||
int basePrice;
|
||||
int divisible;
|
||||
String updatedAt;
|
||||
int? id;
|
||||
int? categoryId;
|
||||
String? name;
|
||||
String? ean;
|
||||
int? articul;
|
||||
int? price;
|
||||
int? optPrice;
|
||||
int? basePrice;
|
||||
int? divisible;
|
||||
String? updatedAt;
|
||||
|
||||
static GoodResponse fromMap(Map<String, dynamic> map) {
|
||||
static GoodResponse? fromMap(Map<String, dynamic> map) {
|
||||
if (map == null) return null;
|
||||
GoodResponse goodResponseBean = GoodResponse();
|
||||
goodResponseBean.id = map['id'];
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
class ProductDao {
|
||||
int id;
|
||||
int categoryId;
|
||||
num count;
|
||||
num price;
|
||||
String productName;
|
||||
String categoryName;
|
||||
String eanCode;
|
||||
int article;
|
||||
String excise;
|
||||
int transactionId;
|
||||
int? id;
|
||||
int? categoryId;
|
||||
num? count;
|
||||
num? price;
|
||||
String? productName;
|
||||
String? categoryName;
|
||||
String? eanCode;
|
||||
int? article;
|
||||
String? excise;
|
||||
int? transactionId;
|
||||
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
class TransactionState {
|
||||
String uuid;
|
||||
String? uuid;
|
||||
}
|
||||
|
|
@ -2,17 +2,16 @@
|
|||
/// message : ""
|
||||
/// operation : true
|
||||
|
||||
class Response<T> {
|
||||
List<T> list;
|
||||
String message;
|
||||
bool operation;
|
||||
class Response {
|
||||
List? list;
|
||||
String? message;
|
||||
bool? operation;
|
||||
|
||||
Response();
|
||||
|
||||
factory Response.fromMapList(Map<String, dynamic> map, Function parser) {
|
||||
if (map == null) return null;
|
||||
factory Response.fromMapList(Map<String, dynamic> map, Function? parser) {
|
||||
|
||||
List<T> list = [];
|
||||
List list = [];
|
||||
if (map['list'] != null) {
|
||||
(map['list'] as List).forEach((element) {
|
||||
if(parser == null)
|
||||
|
|
|
|||
|
|
@ -28,15 +28,15 @@ final Logger log = getLogger('SetSellStateAction');
|
|||
|
||||
final DbService _dbService = locator<DbService>();
|
||||
|
||||
ThunkAction<AppState> addSellItem({Good good, String excise}) {
|
||||
ThunkAction<AppState> addSellItem({required Good good, String? excise}) {
|
||||
return (Store<AppState> store) async {
|
||||
log.i('addSellItem');
|
||||
int appCompanyId = store.state.userState.auth.companyId;
|
||||
String uuid = store.state.sellState.transactionState.uuid;
|
||||
int? appCompanyId = store.state.userState!.auth!.companyId;
|
||||
String? uuid = store.state.sellState!.transactionState!.uuid;
|
||||
|
||||
Transaction transaction;
|
||||
Transaction? transaction;
|
||||
|
||||
if (uuid != null && good != null) {
|
||||
if (uuid != null ) {
|
||||
List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere(
|
||||
TransactionTableName,
|
||||
'$TransactionColumnAppCompanyId = ? and $TransactionColumnStatus = ? and ${TransactionColumnType} = ?',
|
||||
|
|
@ -45,7 +45,7 @@ ThunkAction<AppState> addSellItem({Good good, String excise}) {
|
|||
if (set.isNotEmpty) {
|
||||
for (Map<String, dynamic> map in set) {
|
||||
Transaction _transaction = Transaction.fromMap(map);
|
||||
ProductDao _product = ProductDao.fromMap(jsonDecode(_transaction.data));
|
||||
ProductDao _product = ProductDao.fromMap(jsonDecode(_transaction.data!));
|
||||
if (_product.id == good.id && _product.excise == excise) {
|
||||
transaction = _transaction;
|
||||
break;
|
||||
|
|
@ -55,8 +55,8 @@ ThunkAction<AppState> addSellItem({Good good, String excise}) {
|
|||
}
|
||||
|
||||
if (transaction != null) {
|
||||
ProductDao item = ProductDao.fromMap(jsonDecode(transaction.data));
|
||||
item..count = item.count + 1;
|
||||
ProductDao item = ProductDao.fromMap(jsonDecode(transaction.data!));
|
||||
item..count = item.count! + 1;
|
||||
transaction.data = jsonEncode(item.toMap());
|
||||
transaction.createdAt = DateTime.now().toIso8601String();
|
||||
_dbService.update(TransactionTableName, transaction.toMap());
|
||||
|
|
@ -100,11 +100,11 @@ ThunkAction<AppState> addSellItem({Good good, String excise}) {
|
|||
};
|
||||
}
|
||||
|
||||
ThunkAction<AppState> removeSellItem({int transactionId}) {
|
||||
ThunkAction<AppState> removeSellItem({required int transactionId}) {
|
||||
return (Store<AppState> store) async {
|
||||
|
||||
int appCompanyId = store.state.userState.auth.companyId;
|
||||
String uuid = store.state.sellState.transactionState.uuid;
|
||||
int? appCompanyId = store.state.userState!.auth!.companyId;
|
||||
String? uuid = store.state.sellState!.transactionState!.uuid;
|
||||
|
||||
int count = await _dbService.delete(TransactionTableName, transactionId);
|
||||
log.i('removeSellItem ${count} by transactionId:${transactionId}');
|
||||
|
|
@ -131,8 +131,8 @@ ThunkAction<AppState> removeSellItem({int transactionId}) {
|
|||
Future<void> removeAllSellData(Store<AppState> store) async {
|
||||
try {
|
||||
log.i('removeAllSellData');
|
||||
int appCompanyId = store.state.userState.auth.companyId;
|
||||
String uuid = store.state.sellState.transactionState.uuid;
|
||||
int? appCompanyId = store.state.userState!.auth!.companyId;
|
||||
String? uuid = store.state.sellState!.transactionState!.uuid;
|
||||
await _dbService.deleteByWhere(
|
||||
TransactionTableName,
|
||||
'$TransactionColumnAppCompanyId = ? '
|
||||
|
|
@ -149,18 +149,18 @@ Future<void> removeAllSellData(Store<AppState> store) async {
|
|||
Future<void> loadSellData(Store<AppState> store) async {
|
||||
try {
|
||||
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(
|
||||
TransactionTableName,
|
||||
'$TransactionColumnAppCompanyId = ? and $TransactionColumnStatus = ? and ${TransactionColumnType} = ?',
|
||||
[appCompanyId, TransactionStatusPrepare, TransactionTypeSell],
|
||||
orderBy: '$TransactionColumnCreatedAt desc');
|
||||
List<ProductDao> list = [];
|
||||
String uuid;
|
||||
String? uuid;
|
||||
for (Map<String, dynamic> map in set) {
|
||||
Transaction transaction = Transaction.fromMap(map);
|
||||
uuid = transaction.uuid;
|
||||
ProductDao productDao = ProductDao.fromMap(jsonDecode(transaction.data));
|
||||
ProductDao productDao = ProductDao.fromMap(jsonDecode(transaction.data!));
|
||||
productDao.transactionId = transaction.id;
|
||||
list.add(productDao);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ ThunkAction<AppState> authenticate(String email, String password) {
|
|||
store.dispatch(SetUserStateAction(UserState(isLoading: true)));
|
||||
try {
|
||||
AuthResponse result = await _api.login(email, password);
|
||||
if (result.operation) {
|
||||
_api.token = result.token;
|
||||
if ( result.operation!) {
|
||||
_api.token = result.token!;
|
||||
store.dispatch(SetUserStateAction(UserState(isLoading: false, auth: result)));
|
||||
_navigation.replace(MainViewRoute);
|
||||
_afterAuth(store);
|
||||
} else {
|
||||
_dialogService.showDialog(title: 'Внимание', buttonTitle: 'Ok', description: result.message);
|
||||
_dialogService.showDialog(title: 'Внимание', buttonTitle: 'Ok', description: result.message!);
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
|
|
@ -48,13 +48,13 @@ ThunkAction<AppState> authenticate(String email, String password) {
|
|||
Future<void> auth(Store<AppState> store) async {
|
||||
store.dispatch(SetUserStateAction(UserState(isLoading: true)));
|
||||
try {
|
||||
UserState state = store.state.userState;
|
||||
if(state.auth.operation == false) {
|
||||
UserState? state = store.state.userState;
|
||||
if(state!.auth!.operation == false) {
|
||||
_navigation.replace(LoginViewRoute);
|
||||
} else {
|
||||
AuthResponse response = await _api.auth(state.auth.token);
|
||||
if(response.operation){
|
||||
_api.token = response.token;
|
||||
AuthResponse response = await _api.auth(state.auth!.token!);
|
||||
if(response.operation!){
|
||||
_api.token = response.token!;
|
||||
_navigation.replace(MainViewRoute);
|
||||
_afterAuth(store);
|
||||
} else {
|
||||
|
|
@ -72,12 +72,12 @@ Future<void> logout(Store<AppState> store) async {
|
|||
store.dispatch(SetUserStateAction(UserState(isLoading: true)));
|
||||
try {
|
||||
AuthResponse result = await _api.logout();
|
||||
if (result.operation) {
|
||||
if (result.operation!) {
|
||||
_api.token = null;
|
||||
store.dispatch(SetUserStateAction(UserState(isLoading: false, auth: AuthResponse())));
|
||||
_navigation.replace(LoginViewRoute);
|
||||
} else {
|
||||
_dialogService.showDialog(title: 'Внимание', buttonTitle: 'Ok', description: result.message);
|
||||
_dialogService.showDialog(title: 'Внимание', buttonTitle: 'Ok', description: result.message!);
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import 'package:satu/core/redux/state/user_state.dart';
|
|||
navReducer(NavState prevState, SetNavStateAction action) {
|
||||
final payload = action.navState;
|
||||
return prevState.copyWith(
|
||||
drawerViewClass: payload.drawerViewClass,
|
||||
selectedTabIndex: payload.selectedTabIndex,
|
||||
drawerViewClass: payload.drawerViewClass!,
|
||||
selectedTabIndex: payload.selectedTabIndex!,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import 'package:satu/views/work/work_view.dart';
|
|||
|
||||
@immutable
|
||||
class NavState {
|
||||
final Type drawerViewClass;
|
||||
final int selectedTabIndex;
|
||||
final Type? drawerViewClass;
|
||||
final int? selectedTabIndex;
|
||||
|
||||
NavState({this.drawerViewClass, this.selectedTabIndex});
|
||||
|
||||
|
|
@ -14,8 +14,8 @@ class NavState {
|
|||
);
|
||||
|
||||
NavState copyWith({
|
||||
@required int selectedTabIndex,
|
||||
@required Type drawerViewClass,
|
||||
required int? selectedTabIndex,
|
||||
required Type? drawerViewClass,
|
||||
}) {
|
||||
return NavState(
|
||||
selectedTabIndex: selectedTabIndex ?? this.selectedTabIndex,
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import 'package:satu/core/models/flow/transaction_state.dart';
|
|||
|
||||
@immutable
|
||||
class SellState {
|
||||
final List<ProductDao> items;
|
||||
final TransactionState transactionState;
|
||||
final List<ProductDao>? items;
|
||||
final TransactionState? transactionState;
|
||||
|
||||
SellState({this.items, this.transactionState});
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ class SellState {
|
|||
transactionState: TransactionState(),
|
||||
);
|
||||
|
||||
SellState copyWith({@required List<ProductDao> items, @required TransactionState transactionState}) {
|
||||
SellState copyWith({required List<ProductDao>? items, required TransactionState? transactionState}) {
|
||||
return SellState(items: items ?? this.items, transactionState: transactionState ?? this.transactionState);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ import 'package:satu/core/models/auth/auth_response.dart';
|
|||
|
||||
@immutable
|
||||
class UserState {
|
||||
final bool isError;
|
||||
final bool isLoading;
|
||||
final AuthResponse auth;
|
||||
final bool? isError;
|
||||
final bool? isLoading;
|
||||
final AuthResponse? auth;
|
||||
|
||||
|
||||
UserState(
|
||||
|
|
@ -16,16 +16,16 @@ class UserState {
|
|||
this.auth,
|
||||
});
|
||||
|
||||
factory UserState.initial(UserState payload) => UserState(
|
||||
factory UserState.initial(UserState? payload) => UserState(
|
||||
isLoading: false,
|
||||
isError: false,
|
||||
auth: payload?.auth ?? (AuthResponse()..operation=false),
|
||||
);
|
||||
|
||||
UserState copyWith({
|
||||
@required bool isError,
|
||||
@required bool isLoading,
|
||||
@required AuthResponse auth
|
||||
required bool? isError,
|
||||
required bool? isLoading,
|
||||
required AuthResponse? auth
|
||||
}) {
|
||||
return UserState(
|
||||
isError: isError ?? this.isError,
|
||||
|
|
@ -34,7 +34,7 @@ class UserState {
|
|||
);
|
||||
}
|
||||
|
||||
static UserState fromJson(dynamic json) {
|
||||
static UserState? fromJson(dynamic? json) {
|
||||
return json != null
|
||||
? UserState(
|
||||
auth: AuthResponse.fromMap(json['auth']),
|
||||
|
|
@ -44,7 +44,7 @@ class UserState {
|
|||
|
||||
dynamic toJson() {
|
||||
return {
|
||||
"auth": auth != null ? auth.toJson() : null,
|
||||
"auth": auth != null ? auth!.toJson() : null,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,15 +20,15 @@ import 'actions/user_actions.dart';
|
|||
AppState appReducer(AppState state, dynamic action) {
|
||||
if (action is SetUserStateAction) {
|
||||
/** UserAction **/
|
||||
final nextState = userReducer(state.userState, action);
|
||||
final nextState = userReducer(state.userState!, action);
|
||||
return state.copyWith(userState: nextState);
|
||||
} else if (action is SetNavStateAction) {
|
||||
/** NavAction **/
|
||||
final nextState = navReducer(state.navState, action);
|
||||
final nextState = navReducer(state.navState!, action);
|
||||
return state.copyWith(navState: nextState);
|
||||
} else if (action is SetSellStateAction) {
|
||||
/** NavAction **/
|
||||
final nextState = sellReducer(state.sellState, action);
|
||||
final nextState = sellReducer(state.sellState!, action);
|
||||
return state.copyWith(sellState: nextState);
|
||||
}
|
||||
return state;
|
||||
|
|
@ -37,9 +37,9 @@ AppState appReducer(AppState state, dynamic action) {
|
|||
//Main State
|
||||
@immutable
|
||||
class AppState {
|
||||
final UserState userState;
|
||||
final NavState navState;
|
||||
final SellState sellState;
|
||||
final UserState? userState;
|
||||
final NavState? navState;
|
||||
final SellState? sellState;
|
||||
|
||||
|
||||
AppState({
|
||||
|
|
@ -50,9 +50,9 @@ class AppState {
|
|||
|
||||
//stable work
|
||||
AppState copyWith({
|
||||
UserState userState,
|
||||
NavState navState,
|
||||
SellState sellState,
|
||||
@required UserState? userState,
|
||||
@required NavState? navState,
|
||||
@required SellState? sellState,
|
||||
}) {
|
||||
return AppState(
|
||||
userState: userState ?? this.userState,
|
||||
|
|
@ -61,7 +61,7 @@ class AppState {
|
|||
);
|
||||
}
|
||||
|
||||
static AppState fromJson(dynamic json){
|
||||
static AppState? fromJson(dynamic json){
|
||||
return json !=null
|
||||
? AppState(
|
||||
userState: UserState.fromJson(json['userState']),
|
||||
|
|
@ -71,15 +71,15 @@ class AppState {
|
|||
|
||||
dynamic toJson() {
|
||||
return {
|
||||
"userState" : userState.toJson(),
|
||||
"userState" : userState!.toJson(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
class Redux {
|
||||
static Store<AppState> _store;
|
||||
static Store<AppState>? _store;
|
||||
|
||||
static Store<AppState> get store {
|
||||
static Store<AppState>? get store {
|
||||
if (_store == null) {
|
||||
throw Exception("store is not initialized");
|
||||
} else {
|
||||
|
|
@ -96,7 +96,7 @@ class Redux {
|
|||
);
|
||||
|
||||
final initialState = await persist.load();
|
||||
final userStateInitial = UserState.initial(initialState?.userState);
|
||||
final userStateInitial = UserState.initial(initialState!.userState!);
|
||||
final navStateInitial = NavState.initial();
|
||||
final sellStateInitial = SellState.initial();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@ class ApiService extends BaseService {
|
|||
var client = new http.Client();
|
||||
|
||||
//TOKEN
|
||||
String _token;
|
||||
String? _token;
|
||||
|
||||
String get token => this._token;
|
||||
String? get token => this._token;
|
||||
|
||||
set token(String value) => this._token = value;
|
||||
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>{
|
||||
HttpHeaders.contentTypeHeader: "application/json",
|
||||
HttpHeaders.cacheControlHeader: "no-cache"
|
||||
|
|
@ -33,7 +33,7 @@ class ApiService extends BaseService {
|
|||
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>{
|
||||
HttpHeaders.contentTypeHeader: "application/json",
|
||||
HttpHeaders.cacheControlHeader: "no-cache"
|
||||
|
|
@ -55,7 +55,7 @@ class ApiService extends BaseService {
|
|||
AuthResponse result;
|
||||
try {
|
||||
String response = await _post('/login', requestBody: requestBody);
|
||||
result = AuthResponse.fromMap(json.decode(response));
|
||||
result = AuthResponse.fromMap(json.decode(response))!;
|
||||
} catch (e, stack) {
|
||||
log.e("login", e, stack);
|
||||
result = new AuthResponse()
|
||||
|
|
@ -70,7 +70,7 @@ class ApiService extends BaseService {
|
|||
AuthResponse result;
|
||||
try {
|
||||
String response = await _post('/authorization', requestBody: requestBody);
|
||||
result = AuthResponse.fromMap(json.decode(response));
|
||||
result = AuthResponse.fromMap(json.decode(response))!;
|
||||
} catch (e, stack) {
|
||||
log.e("authorization", e, stack);
|
||||
result = new AuthResponse()
|
||||
|
|
@ -85,7 +85,7 @@ class ApiService extends BaseService {
|
|||
AuthResponse result;
|
||||
try {
|
||||
String response = await _post('/auth', header: headers);
|
||||
result = AuthResponse.fromMap(json.decode(response));
|
||||
result = AuthResponse.fromMap(json.decode(response))!;
|
||||
} catch (e, stack) {
|
||||
log.e("auth", e, stack);
|
||||
result = new AuthResponse()
|
||||
|
|
@ -100,7 +100,7 @@ class ApiService extends BaseService {
|
|||
AuthResponse result;
|
||||
try {
|
||||
String response = await _post('/logout', header: headers);
|
||||
result = AuthResponse.fromMap(json.decode(response));
|
||||
result = AuthResponse.fromMap(json.decode(response))!;
|
||||
} catch (e, stack) {
|
||||
log.e("auth", e, stack);
|
||||
result = new AuthResponse()
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ class DbService extends BaseService {
|
|||
static final DbService instance = DbService._privateConstructor();
|
||||
|
||||
// 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;
|
||||
// lazily instantiate the db the first time it is accessed
|
||||
_database = await _initDatabase();
|
||||
|
|
@ -89,64 +89,64 @@ class DbService extends BaseService {
|
|||
// and the value is the column value. The return value is the id of the
|
||||
// inserted row.
|
||||
Future<int> insert(String table, Map<String, dynamic> row) async {
|
||||
Database db = await instance.database;
|
||||
return await db.insert(table, row);
|
||||
Database? db = await instance.database;
|
||||
return await db!.insert(table, row);
|
||||
}
|
||||
|
||||
// All of the rows are returned as a list of maps, where each map is
|
||||
// a key-value list of columns.
|
||||
Future<List<Map<String, dynamic>>> queryAllRows(String table) async {
|
||||
Database db = await instance.database;
|
||||
return await db.query(table);
|
||||
Database? db = await instance.database;
|
||||
return await db!.query(table);
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> queryRaw(String sql, List<dynamic> args) async {
|
||||
Database db = await instance.database;
|
||||
return await db.rawQuery(sql, args );
|
||||
Database? db = await instance.database;
|
||||
return await db!.rawQuery(sql, args );
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> queryAllRowsOrderBy(String table, String orderBy) async {
|
||||
Database db = await instance.database;
|
||||
return await db.query(table, orderBy: orderBy);
|
||||
Database? db = await instance.database;
|
||||
return await db!.query(table, orderBy: orderBy);
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> queryRowsWithWhere(
|
||||
String table, String where, List<dynamic> args, { String orderBy }) async {
|
||||
Database db = await instance.database;
|
||||
return await db.query(table, where: where, whereArgs: args, orderBy: orderBy);
|
||||
String table, String where, List<dynamic> args, { String? orderBy }) async {
|
||||
Database? db = await instance.database;
|
||||
return await db!.query(table, where: where, whereArgs: args, orderBy: orderBy);
|
||||
}
|
||||
|
||||
// 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.
|
||||
Future<int> queryRowCount(String table) async {
|
||||
Database db = await instance.database;
|
||||
Future<int?> queryRowCount(String table) async {
|
||||
Database? db = await instance.database;
|
||||
return Sqflite.firstIntValue(
|
||||
await db.rawQuery('SELECT COUNT(*) FROM $table'));
|
||||
await db!.rawQuery('SELECT COUNT(*) FROM $table'));
|
||||
}
|
||||
|
||||
// We are assuming here that the id column in the map is set. The other
|
||||
// column values will be used to update the row.
|
||||
Future<int> update(String table, Map<String, dynamic> row) async {
|
||||
Database db = await instance.database;
|
||||
Database? db = await instance.database;
|
||||
int id = row['id'];
|
||||
return await db.update(table, row, where: 'id = ?', whereArgs: [id]);
|
||||
return await db!.update(table, row, where: 'id = ?', whereArgs: [id]);
|
||||
}
|
||||
|
||||
// Deletes the row specified by the id. The number of affected rows is
|
||||
// returned. This should be 1 as long as the row exists.
|
||||
Future<int> delete(String table, int id) async {
|
||||
Database db = await instance.database;
|
||||
return await db.delete(table, where: 'id = ?', whereArgs: [id]);
|
||||
Database? db = await instance.database;
|
||||
return await db!.delete(table, where: 'id = ?', whereArgs: [id]);
|
||||
}
|
||||
|
||||
Future<int> deleteAll(String table) async {
|
||||
Database db = await instance.database;
|
||||
return await db.delete(table);
|
||||
Database? db = await instance.database;
|
||||
return await db!.delete(table);
|
||||
}
|
||||
|
||||
Future<int> deleteByWhere(String table, String where, List<dynamic> args) async {
|
||||
Database db = await instance.database;
|
||||
return await db.delete(table, where: where, whereArgs: args);
|
||||
Database? db = await instance.database;
|
||||
return await db!.delete(table, where: where, whereArgs: args);
|
||||
}
|
||||
|
||||
Future close() async => instance.close();
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ import 'package:satu/core/models/dialog_models.dart';
|
|||
|
||||
class DialogService {
|
||||
GlobalKey<NavigatorState> _dialogNavigationKey = GlobalKey<NavigatorState>();
|
||||
Function(DialogRequest) _showDialogListener;
|
||||
Function(DialogRequest) _showDialogInputListener;
|
||||
Completer<DialogResponse> _dialogCompleter;
|
||||
Function(DialogRequest)? _showDialogListener;
|
||||
Function(DialogRequest)? _showDialogInputListener;
|
||||
Completer<DialogResponse>? _dialogCompleter;
|
||||
|
||||
Completer<DialogResponse> get completer => this._dialogCompleter;
|
||||
Completer<DialogResponse>? get completer => this._dialogCompleter;
|
||||
|
||||
GlobalKey<NavigatorState> get dialogNavigationKey => _dialogNavigationKey;
|
||||
|
||||
|
|
@ -23,53 +23,53 @@ class DialogService {
|
|||
/// Calls the dialog listener and returns a Future that will wait for dialogComplete.
|
||||
Future<DialogResponse> showDialog({
|
||||
String title = 'Aman Касса',
|
||||
String description,
|
||||
String? description,
|
||||
String buttonTitle = 'Ok',
|
||||
}) {
|
||||
_dialogCompleter = Completer<DialogResponse>();
|
||||
_showDialogListener(DialogRequest(
|
||||
_showDialogListener!(DialogRequest(
|
||||
title: title,
|
||||
description: description,
|
||||
buttonTitle: buttonTitle,
|
||||
));
|
||||
return _dialogCompleter.future;
|
||||
return _dialogCompleter!.future;
|
||||
}
|
||||
|
||||
/// Shows a confirmation dialog
|
||||
Future<DialogResponse> showConfirmationDialog(
|
||||
{String title,
|
||||
String description,
|
||||
{String? title,
|
||||
String? description,
|
||||
String confirmationTitle = 'Ok',
|
||||
String cancelTitle = 'Cancel'}) {
|
||||
_dialogCompleter = Completer<DialogResponse>();
|
||||
_showDialogListener(DialogRequest(
|
||||
_showDialogListener!(DialogRequest(
|
||||
title: title,
|
||||
description: description,
|
||||
buttonTitle: confirmationTitle,
|
||||
cancelTitle: cancelTitle));
|
||||
return _dialogCompleter.future;
|
||||
return _dialogCompleter!.future;
|
||||
}
|
||||
|
||||
Future<DialogResponse> showConfirmationDialogInput(
|
||||
{String title = ' Aman Касса',
|
||||
String description,
|
||||
String? description,
|
||||
String confirmationTitle = 'Ok',
|
||||
String cancelTitle = 'Cancel',
|
||||
String formatType}) {
|
||||
String? formatType}) {
|
||||
_dialogCompleter = Completer<DialogResponse>();
|
||||
_showDialogInputListener(DialogRequest(
|
||||
_showDialogInputListener!(DialogRequest(
|
||||
title: title,
|
||||
description: description,
|
||||
buttonTitle: confirmationTitle,
|
||||
cancelTitle: cancelTitle,
|
||||
formatType: formatType));
|
||||
return _dialogCompleter.future;
|
||||
return _dialogCompleter!.future;
|
||||
}
|
||||
|
||||
/// Completes the _dialogCompleter to resume the Future's execution call
|
||||
void dialogComplete(DialogResponse response) {
|
||||
_dialogNavigationKey.currentState.pop();
|
||||
_dialogCompleter.complete(response);
|
||||
_dialogNavigationKey.currentState!.pop();
|
||||
_dialogCompleter!.complete(response);
|
||||
_dialogCompleter = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ class DictionaryService extends BaseService {
|
|||
|
||||
Future<void> refreshCategory() async {
|
||||
try {
|
||||
int appCompanyId = Redux.store.state.userState.auth.companyId;
|
||||
int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
||||
Response categories = await _api.dictionaries('/categories');
|
||||
if (categories.operation && categories.list.isNotEmpty) {
|
||||
for (dynamic map in categories.list) {
|
||||
CategoryResponse cat = CategoryResponse.fromMap(map);
|
||||
if (categories.operation! && categories.list!.isNotEmpty) {
|
||||
for (dynamic map in categories.list!) {
|
||||
CategoryResponse cat = CategoryResponse.fromMap(map)!;
|
||||
Category entity = new Category()
|
||||
..id = cat.id
|
||||
..name = cat.name
|
||||
|
|
@ -46,7 +46,7 @@ class DictionaryService extends BaseService {
|
|||
Future<List<Category>> getCategoryByParentId(int parentId ) async {
|
||||
List<Category> list = [];
|
||||
try {
|
||||
int appCompanyId = Redux.store.state.userState.auth.companyId;
|
||||
int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
||||
List<Map<String, dynamic>> elements = await _db.queryRowsWithWhere(CategoryTableName, '$CategoryColumnAppCompanyId = ? and $CategoryColumnParentIn = ?', [appCompanyId, parentId]);
|
||||
elements.forEach((element) {
|
||||
list.add(Category.fromMap(element));
|
||||
|
|
@ -60,7 +60,7 @@ class DictionaryService extends BaseService {
|
|||
Future<List<Good>> getGoodsByCategoryId(int categoryId ) async {
|
||||
List<Good> list = [];
|
||||
try {
|
||||
int appCompanyId = Redux.store.state.userState.auth.companyId;
|
||||
int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
||||
List<Map<String, dynamic>> elements = await _db.queryRowsWithWhere(GoodTableName, '$GoodColumnAppCompanyId = ? and $GoodColumnCategoryId = ?', [appCompanyId, categoryId]);
|
||||
elements.forEach((element) {
|
||||
list.add(Good.fromMap(element));
|
||||
|
|
@ -74,7 +74,7 @@ class DictionaryService extends BaseService {
|
|||
Future<List<Good>> getGoodsByNameOrEan( String query ) async {
|
||||
List<Good> list = [];
|
||||
try {
|
||||
int appCompanyId = Redux.store.state.userState.auth.companyId;
|
||||
int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
||||
String where = '( $GoodColumnAppCompanyId = ? and $GoodColumnName like ? ) ';
|
||||
List args = [appCompanyId, '%$query%'];
|
||||
if(_isNumericInt(query)){
|
||||
|
|
@ -100,11 +100,11 @@ class DictionaryService extends BaseService {
|
|||
|
||||
Future<void> refreshGood() async {
|
||||
try {
|
||||
int appCompanyId = Redux.store.state.userState.auth.companyId;
|
||||
int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
|
||||
Response categories = await _api.dictionaries('/goods');
|
||||
if (categories.operation && categories.list.isNotEmpty) {
|
||||
for (dynamic map in categories.list) {
|
||||
GoodResponse good = GoodResponse.fromMap(map);
|
||||
if (categories.operation! && categories.list!.isNotEmpty) {
|
||||
for (dynamic map in categories.list!) {
|
||||
GoodResponse good = GoodResponse.fromMap(map)!;
|
||||
Good entity = new Good()
|
||||
..id = good.id
|
||||
..name = good.name
|
||||
|
|
|
|||
|
|
@ -8,27 +8,27 @@ class NavigatorService extends BaseService {
|
|||
|
||||
Future<dynamic> push(String routeName, {dynamic arguments}) {
|
||||
log.d('routeName: $routeName');
|
||||
return navigatorKey.currentState
|
||||
return navigatorKey.currentState!
|
||||
.pushNamed(routeName, arguments: arguments);
|
||||
}
|
||||
|
||||
Future<dynamic> replace(String routeName, {dynamic arguments}) {
|
||||
log.d('routeName: $routeName');
|
||||
return navigatorKey.currentState
|
||||
return navigatorKey.currentState!
|
||||
.pushNamedAndRemoveUntil(routeName, (Route<dynamic> route) => false, arguments: arguments);
|
||||
}
|
||||
|
||||
|
||||
Future<T> navigateToPage<T>(MaterialPageRoute<T> pageRoute) async {
|
||||
Future<T?> navigateToPage<T>(MaterialPageRoute<T> pageRoute) async {
|
||||
log.d('navigateToPage: pageRoute: ${pageRoute.settings.name}');
|
||||
if (navigatorKey.currentState == null) {
|
||||
log.e('navigateToPage: Navigator State is null');
|
||||
return null;
|
||||
}
|
||||
return navigatorKey.currentState.push(pageRoute);
|
||||
return navigatorKey.currentState!.push(pageRoute);
|
||||
}
|
||||
|
||||
Future<T> navigateToPageWithReplacement<T>(
|
||||
Future<T?> navigateToPageWithReplacement<T>(
|
||||
MaterialPageRoute<T> pageRoute) async {
|
||||
log.d('navigateToPageWithReplacement: '
|
||||
'pageRoute: ${pageRoute.settings.name}');
|
||||
|
|
@ -36,15 +36,15 @@ class NavigatorService extends BaseService {
|
|||
log.e('navigateToPageWithReplacement: Navigator State is null');
|
||||
return null;
|
||||
}
|
||||
return navigatorKey.currentState.pushReplacement(pageRoute);
|
||||
return navigatorKey.currentState!.pushReplacement(pageRoute);
|
||||
}
|
||||
|
||||
void pop<T>([T result]) {
|
||||
void pop<T>([T? result]) {
|
||||
log.d('goBack:');
|
||||
if (navigatorKey.currentState == null) {
|
||||
log.e('goBack: Navigator State is null');
|
||||
return;
|
||||
}
|
||||
navigatorKey.currentState.pop(result);
|
||||
navigatorKey.currentState!.pop(result);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,13 +14,13 @@ class SimpleLogPrinter extends LogPrinter {
|
|||
var error = event.error?.toString() ?? '';
|
||||
var color = PrettyPrinter.levelColors[level];
|
||||
var emoji = PrettyPrinter.levelEmojis[level];
|
||||
String stack;
|
||||
String? stack;
|
||||
if (event.stackTrace == null) {
|
||||
stack = formatStackTrace(StackTrace.current, 2);
|
||||
} else {
|
||||
stack = formatStackTrace(event.stackTrace, 1);
|
||||
stack = formatStackTrace(event.stackTrace!, 1);
|
||||
}
|
||||
print(color(' $emoji $message $error -> $stack '));
|
||||
print(color!(' $emoji $message $error -> $stack '));
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
@ -33,8 +33,8 @@ class SimpleLogPrinter extends LogPrinter {
|
|||
}
|
||||
}
|
||||
|
||||
String formatStackTrace(StackTrace stackTrace, int methodPosition) {
|
||||
var lines = stackTrace.toString()?.split('\n');
|
||||
String? formatStackTrace(StackTrace stackTrace, int methodPosition) {
|
||||
var lines = stackTrace.toString().split('\n');
|
||||
var formatted = <String>[];
|
||||
var count = 0;
|
||||
for (var line in lines) {
|
||||
|
|
@ -61,7 +61,7 @@ class SimpleLogPrinter extends LogPrinter {
|
|||
if (match == null) {
|
||||
return false;
|
||||
}
|
||||
return match.group(2).startsWith('package:logger');
|
||||
return match.group(2)!.startsWith('package:logger');
|
||||
}
|
||||
|
||||
bool _discardWebStacktraceLine(String line) {
|
||||
|
|
@ -69,8 +69,8 @@ class SimpleLogPrinter extends LogPrinter {
|
|||
if (match == null) {
|
||||
return false;
|
||||
}
|
||||
return match.group(1).startsWith('packages/logger') ||
|
||||
match.group(1).startsWith('dart-sdk/lib');
|
||||
return match.group(1)!.startsWith('packages/logger') ||
|
||||
match.group(1)!.startsWith('dart-sdk/lib');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
List<String> parseListString(json){
|
||||
List<String>? parseListString(json){
|
||||
if(json==null) return null;
|
||||
return new List<String>.from(json);
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ class MainApplication extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
|
||||
return StoreProvider<AppState>(
|
||||
store: Redux.store,
|
||||
store: Redux.store!,
|
||||
child: ScreenUtilInit(
|
||||
designSize: Size(411.43, 683.43),
|
||||
builder: () => MaterialApp(
|
||||
|
|
@ -51,7 +51,7 @@ class MainApplication extends StatelessWidget {
|
|||
builder: (context, child) => Navigator(
|
||||
key: locator<DialogService>().dialogNavigationKey,
|
||||
onGenerateRoute: (settings) => MaterialPageRoute(
|
||||
builder: (context) => DialogManager(child: child)),
|
||||
builder: (context) => DialogManager(child: child!)),
|
||||
),
|
||||
navigatorKey: locator<NavigatorService>().navigatorKey,
|
||||
home: StartUpView(), // first page
|
||||
|
|
|
|||
|
|
@ -14,32 +14,32 @@ Route<dynamic> generateRoute(RouteSettings settings) {
|
|||
case LoginViewRoute:
|
||||
//LoginModel model = settings.arguments as LoginModel;
|
||||
return _getPageRoute(
|
||||
routeName: settings.name,
|
||||
routeName: settings.name!,
|
||||
viewToShow: LoginView(),
|
||||
);
|
||||
case WorkViewRoute:
|
||||
return _getPageRoute(
|
||||
routeName: settings.name,
|
||||
routeName: settings.name!,
|
||||
viewToShow: WorkView(),
|
||||
);
|
||||
case MainViewRoute:
|
||||
return _getPageRoute(
|
||||
routeName: settings.name,
|
||||
routeName: settings.name!,
|
||||
viewToShow: MainView(),
|
||||
);
|
||||
case AddProductViewRoute:
|
||||
return _getPageRoute(
|
||||
routeName: settings.name,
|
||||
routeName: settings.name!,
|
||||
viewToShow: AddProductView(),
|
||||
);
|
||||
case AddByBarcodeViewRoute:
|
||||
return _getPageRoute(
|
||||
routeName: settings.name,
|
||||
routeName: settings.name!,
|
||||
viewToShow: AddByBarcodeView(title: 'Scanner',),
|
||||
);
|
||||
case SettingPrinterBluetoothViewRoute:
|
||||
return _getPageRoute(
|
||||
routeName: settings.name,
|
||||
routeName: settings.name!,
|
||||
//viewToShow: PrinterSelectView(title: 'Принтер печати чеков',),
|
||||
);
|
||||
// case ImageShowRoute:
|
||||
|
|
@ -58,21 +58,21 @@ Route<dynamic> generateRoute(RouteSettings settings) {
|
|||
}
|
||||
}
|
||||
|
||||
PageRoute _getPageRoute({String routeName, Widget viewToShow}) {
|
||||
PageRoute _getPageRoute({String? routeName, Widget? viewToShow}) {
|
||||
return MaterialPageRoute(
|
||||
settings: RouteSettings(
|
||||
name: routeName,
|
||||
),
|
||||
builder: (_) => viewToShow);
|
||||
builder: (_) => viewToShow!);
|
||||
}
|
||||
|
||||
class SlideRightRoute extends PageRouteBuilder {
|
||||
final Widget widget;
|
||||
final Widget? widget;
|
||||
SlideRightRoute({this.widget})
|
||||
: super(
|
||||
pageBuilder: (BuildContext context, Animation<double> animation,
|
||||
Animation<double> secondaryAnimation) {
|
||||
return widget;
|
||||
return widget!;
|
||||
},
|
||||
transitionsBuilder: (BuildContext context,
|
||||
Animation<double> animation,
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class AddByBarcodeView extends StatefulWidget {
|
||||
final String title;
|
||||
final int transactionId;
|
||||
final String? title;
|
||||
final int? transactionId;
|
||||
|
||||
const AddByBarcodeView({
|
||||
Key key,
|
||||
Key? key,
|
||||
this.title,
|
||||
this.transactionId,
|
||||
}) : super(key: key);
|
||||
|
|
@ -30,7 +30,7 @@ class _AddByBarcodeViewState extends State<AddByBarcodeView> {
|
|||
child: Center(
|
||||
child: Hero(
|
||||
tag: 'text',
|
||||
child: Text(widget.title)),
|
||||
child: Text(widget.title ?? '')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ class AddProductView extends StatefulWidget {
|
|||
class _AddProductViewState extends State<AddProductView> {
|
||||
final DictionaryService _dictionaryService = locator<DictionaryService>();
|
||||
final NavigatorService _navigatorService = locator<NavigatorService>();
|
||||
TextEditingController _searchTextController;
|
||||
late TextEditingController _searchTextController;
|
||||
final FocusNode _searchFocusNode = new FocusNode();
|
||||
|
||||
|
||||
List<Category> _history;
|
||||
List<Category> _categories;
|
||||
List<Good> _goods;
|
||||
List<Category>? _history;
|
||||
List<Category>? _categories;
|
||||
List<Good>? _goods;
|
||||
|
||||
|
||||
@override
|
||||
|
|
@ -78,7 +78,7 @@ class _AddProductViewState extends State<AddProductView> {
|
|||
itemCount: catSize + goodSize,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
if (index < catSize) {
|
||||
Category category = _categories[index];
|
||||
Category category = _categories![index];
|
||||
return AddCategoryListItem(
|
||||
name: category.name,
|
||||
isOdd: index % 2 == 0,
|
||||
|
|
@ -86,14 +86,14 @@ class _AddProductViewState extends State<AddProductView> {
|
|||
onPress: () => onCategoryPress(category),
|
||||
);
|
||||
}
|
||||
Good good = _goods[index - catSize];
|
||||
Good good = _goods![index - catSize];
|
||||
return AddProductListItem(
|
||||
key: Key('product_${good.id}'),
|
||||
ean: good.ean,
|
||||
isOdd: index % 2 == 0,
|
||||
name: good.name,
|
||||
price: good.price,
|
||||
categoryName: _history.last?.name,
|
||||
categoryName: _history?.last?.name!,
|
||||
onPress: () => onGoodPress(good),
|
||||
);
|
||||
},
|
||||
|
|
@ -107,21 +107,21 @@ class _AddProductViewState extends State<AddProductView> {
|
|||
}
|
||||
|
||||
onCategoryPress(Category category) {
|
||||
_history.add(category);
|
||||
navigateCategory(category.id);
|
||||
_history!.add(category);
|
||||
navigateCategory(category.id!);
|
||||
}
|
||||
|
||||
onGoodPress(Good good) {
|
||||
Redux.store.dispatch(addSellItem(good: good));
|
||||
Redux.store!.dispatch(addSellItem(good: good));
|
||||
_navigatorService.pop();
|
||||
}
|
||||
|
||||
List<Widget> actions() {
|
||||
return [
|
||||
if(_history.length > 1)
|
||||
if(_history!.length > 1)
|
||||
FlatButton(onPressed: () {
|
||||
_history.removeLast();
|
||||
navigateCategory(_history.last.id);
|
||||
_history!.removeLast();
|
||||
navigateCategory(_history!.last.id!);
|
||||
}, child: Text('Назад', style: TextStyle(color: Colors.black),),),
|
||||
|
||||
FlatButton(onPressed: reset, child: Text('Сбросить', style: TextStyle(color: Colors.black),),)
|
||||
|
|
|
|||
|
|
@ -5,17 +5,17 @@ import 'package:satu/shared/shared_styles.dart';
|
|||
import 'package:satu/shared/ui_helpers.dart';
|
||||
|
||||
class AddCategoryListItem extends StatelessWidget {
|
||||
final String name;
|
||||
final bool isOdd;
|
||||
final Function onPress;
|
||||
final String? name;
|
||||
final bool? isOdd;
|
||||
final Function? onPress;
|
||||
|
||||
const AddCategoryListItem({Key key, this.name, this.isOdd, this.onPress }) : super(key: key);
|
||||
const AddCategoryListItem({Key? key, this.name, this.isOdd, this.onPress }) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
child: ListTile(
|
||||
onTap: onPress,
|
||||
onTap: () => onPress,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.only(top: 4.0),
|
||||
|
|
@ -23,7 +23,7 @@ class AddCategoryListItem extends StatelessWidget {
|
|||
height: 50,
|
||||
child: Center(
|
||||
child: Text(
|
||||
name,
|
||||
name!,
|
||||
style: productTextStyle,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 3,
|
||||
|
|
@ -31,7 +31,7 @@ class AddCategoryListItem extends StatelessWidget {
|
|||
)
|
||||
),
|
||||
),
|
||||
tileColor: !isOdd ? fillColor : backgroundColor,
|
||||
tileColor: !isOdd! ? fillColor : backgroundColor,
|
||||
trailing: Icon(
|
||||
Icons.arrow_right,
|
||||
color: yellowColor,
|
||||
|
|
|
|||
|
|
@ -5,21 +5,21 @@ import 'package:satu/shared/shared_styles.dart';
|
|||
import 'package:satu/shared/ui_helpers.dart';
|
||||
|
||||
class AddProductListItem extends StatelessWidget {
|
||||
final String name;
|
||||
final String ean;
|
||||
final String categoryName;
|
||||
final num price;
|
||||
final num count;
|
||||
final bool isOdd;
|
||||
final Function onPress;
|
||||
final String? name;
|
||||
final String? ean;
|
||||
final String? categoryName;
|
||||
final num? price;
|
||||
final num? count;
|
||||
final bool? isOdd;
|
||||
final Function? onPress;
|
||||
|
||||
const AddProductListItem({Key key, this.name, this.ean, this.categoryName, this.price, this.count, this.isOdd, this.onPress}) : super(key: key);
|
||||
const AddProductListItem({Key? key, this.name, this.ean, this.categoryName, this.price, this.count, this.isOdd, this.onPress}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
child: ListTile(
|
||||
onTap: onPress,
|
||||
onTap: () => onPress,
|
||||
contentPadding: const EdgeInsets.symmetric( horizontal: 8.0 ,vertical: 4.0 ),
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
|
|
@ -32,12 +32,12 @@ class AddProductListItem extends StatelessWidget {
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(name , style: productTextStyle, overflow: TextOverflow.ellipsis, maxLines: 2,),
|
||||
Text(name! , style: productTextStyle, overflow: TextOverflow.ellipsis, maxLines: 2,),
|
||||
verticalSpaceTiny,
|
||||
if(ean!=null)
|
||||
Text('Штрих-код: $ean' , style: productSubTextStyle,),
|
||||
if(categoryName!=null)
|
||||
Text(categoryName, style: productSubTextStyle,),
|
||||
Text(categoryName!, style: productSubTextStyle,),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
@ -54,7 +54,7 @@ class AddProductListItem extends StatelessWidget {
|
|||
],
|
||||
),
|
||||
),
|
||||
tileColor: !isOdd ? fillColor : backgroundColor,
|
||||
tileColor: !isOdd! ? fillColor : backgroundColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ import 'package:satu/core/utils/locator.dart';
|
|||
import 'package:satu/shared/app_colors.dart';
|
||||
|
||||
class AddProductAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
final String title;
|
||||
final List<Widget> actions;
|
||||
final String? title;
|
||||
final List<Widget>? actions;
|
||||
|
||||
const AddProductAppBar({Key key, this.title, this.actions}) : super(key: key);
|
||||
const AddProductAppBar({Key? key, this.title, this.actions}) : super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppBar(
|
||||
title: Text(title, style: const TextStyle(fontWeight: FontWeight.w700, color: Colors.black, fontSize: 25)),
|
||||
title: Text(title!, style: const TextStyle(fontWeight: FontWeight.w700, color: Colors.black, fontSize: 25)),
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0.0,
|
||||
actions: actions
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import 'package:barcode_scan/gen/protos/protos.pb.dart';
|
||||
import 'package:barcode_scan/gen/protos/protos.pbenum.dart';
|
||||
import 'package:barcode_scan/model/scan_options.dart';
|
||||
import 'package:barcode_scan/platform_wrapper.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -26,9 +22,9 @@ class LoginView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _LoginViewState extends State<LoginView> {
|
||||
TextEditingController emailController;
|
||||
late TextEditingController emailController;
|
||||
|
||||
TextEditingController passwordController;
|
||||
late TextEditingController passwordController;
|
||||
|
||||
final FocusNode passwordNode = new FocusNode();
|
||||
|
||||
|
|
@ -56,7 +52,7 @@ class _LoginViewState extends State<LoginView> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StoreConnector<AppState, UserState>(
|
||||
converter: (store) => store.state.userState,
|
||||
converter: (store) => store.state.userState!,
|
||||
builder: (context, vm) {
|
||||
return Scaffold(
|
||||
key: _scaffoldKey,
|
||||
|
|
@ -110,7 +106,7 @@ class _LoginViewState extends State<LoginView> {
|
|||
width: 150,
|
||||
child: BusyButton(
|
||||
title: 'Войти',
|
||||
busy: vm.isLoading,
|
||||
busy: vm.isLoading!,
|
||||
onPressed: _pressBtnEnter,
|
||||
mainColor: yellowColor,
|
||||
),
|
||||
|
|
@ -135,38 +131,38 @@ class _LoginViewState extends State<LoginView> {
|
|||
}
|
||||
|
||||
_pressBtnEnter() async {
|
||||
Redux.store.dispatch(authenticate(emailController.text, passwordController.text));
|
||||
Redux.store!.dispatch(authenticate(emailController.text, passwordController.text));
|
||||
}
|
||||
|
||||
Future<void> scan() async {
|
||||
try {
|
||||
var options = ScanOptions(strings: {
|
||||
"cancel": 'Отмена',
|
||||
"flash_on": 'Вкл фонарик',
|
||||
"flash_off": 'Выкл фонарик',
|
||||
});
|
||||
var result = await BarcodeScanner.scan(options: options);
|
||||
print(result.type); // The result type (barcode, cancelled, failed)
|
||||
print(result.rawContent); // The barcode content
|
||||
print(result.format); // The barcode format (as enum)
|
||||
print(result.formatNote); // If a unknown format was scanned this field contains a note
|
||||
if (result.type == ResultType.Barcode && result.rawContent?.length == 60) {
|
||||
//Redux.store.dispatch(authenticateToken(result.rawContent));
|
||||
} else if (result.type == ResultType.Error) {
|
||||
_dialogService.showDialog(description: 'Не верный формат QR кода');
|
||||
}
|
||||
} on PlatformException catch (e) {
|
||||
var result = ScanResult.create();
|
||||
result.type = ResultType.Error;
|
||||
result.format = BarcodeFormat.unknown;
|
||||
if (e.code == BarcodeScanner.cameraAccessDenied) {
|
||||
result.rawContent = 'The user did not grant the camera permission!';
|
||||
_dialogService.showDialog(description: 'Нет доступа до камеры устройства');
|
||||
} else {
|
||||
result.rawContent = 'Unknown error: $e';
|
||||
_dialogService.showDialog(description: 'Неизвестная ошибка: $e');
|
||||
}
|
||||
}
|
||||
// try {
|
||||
// var options = ScanOptions(strings: {
|
||||
// "cancel": 'Отмена',
|
||||
// "flash_on": 'Вкл фонарик',
|
||||
// "flash_off": 'Выкл фонарик',
|
||||
// });
|
||||
// var result = await BarcodeScanner.scan(options: options);
|
||||
// print(result.type); // The result type (barcode, cancelled, failed)
|
||||
// print(result.rawContent); // The barcode content
|
||||
// print(result.format); // The barcode format (as enum)
|
||||
// print(result.formatNote); // If a unknown format was scanned this field contains a note
|
||||
// if (result.type == ResultType.Barcode && result.rawContent?.length == 60) {
|
||||
// //Redux.store.dispatch(authenticateToken(result.rawContent));
|
||||
// } else if (result.type == ResultType.Error) {
|
||||
// _dialogService.showDialog(description: 'Не верный формат QR кода');
|
||||
// }
|
||||
// } on PlatformException catch (e) {
|
||||
// var result = ScanResult.create();
|
||||
// result.type = ResultType.Error;
|
||||
// result.format = BarcodeFormat.unknown;
|
||||
// if (e.code == BarcodeScanner.cameraAccessDenied) {
|
||||
// result.rawContent = 'The user did not grant the camera permission!';
|
||||
// _dialogService.showDialog(description: 'Нет доступа до камеры устройства');
|
||||
// } else {
|
||||
// result.rawContent = 'Unknown error: $e';
|
||||
// _dialogService.showDialog(description: 'Неизвестная ошибка: $e');
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,5 +171,5 @@ class LoginModel {
|
|||
final String login;
|
||||
final String password;
|
||||
|
||||
LoginModel({this.authType, this.login, this.password});
|
||||
LoginModel({required this.authType, required this.login, required this.password});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ class _MainViewState extends State<MainView> {
|
|||
key: _navigatorService.scaffoldDrawerKey,
|
||||
drawer: AppDrawer(),
|
||||
body: StoreConnector<AppState, NavState>(
|
||||
converter: (store) => store.state.navState,
|
||||
converter: (store) => store.state.navState!,
|
||||
builder: (_, vm) {
|
||||
return _body(vm.drawerViewClass);
|
||||
return _body(vm.drawerViewClass!);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
|
|||
|
||||
class SettingItem extends StatefulWidget {
|
||||
|
||||
final String name;
|
||||
final String value;
|
||||
final Function onTap;
|
||||
final String? name;
|
||||
final String? value;
|
||||
final Function? onTap;
|
||||
|
||||
SettingItem({Key key, this.name, this.value, this.onTap}) : super(key: key);
|
||||
SettingItem({Key? key, this.name, this.value, this.onTap}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SettingItemState createState() => _SettingItemState();
|
||||
|
|
@ -17,10 +17,10 @@ class _SettingItemState extends State<SettingItem> {
|
|||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
child: ListTile(
|
||||
title: Text(widget.name),
|
||||
subtitle: widget.value !=null ? Text(widget.value) : null,
|
||||
title: Text(widget.name ?? ''),
|
||||
subtitle: widget.value !=null ? Text(widget.value ?? '') : null,
|
||||
trailing: Icon(Icons.chevron_right),
|
||||
onTap: widget.onTap,
|
||||
onTap: () => widget.onTap,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class _StartUpViewState extends State<StartUpView> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StoreConnector<AppState, UserState>(
|
||||
converter: (store) => store.state.userState,
|
||||
converter: (store) => store.state.userState!,
|
||||
builder: (context, userState) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
|
|
@ -56,6 +56,6 @@ class _StartUpViewState extends State<StartUpView> {
|
|||
|
||||
void redirect() async {
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
Redux.store.dispatch(auth);
|
||||
Redux.store!.dispatch(auth);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
|
|||
|
||||
class CustomField extends StatelessWidget {
|
||||
|
||||
final String hintText;
|
||||
final IconData iconData;
|
||||
final String label;
|
||||
final String? hintText;
|
||||
final IconData? iconData;
|
||||
final String? label;
|
||||
|
||||
CustomField({@required this.hintText, @required this.iconData, this.label});
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class OptionPill extends StatelessWidget {
|
|||
final String text;
|
||||
final bool selected;
|
||||
|
||||
OptionPill({@required this.text, @required this.selected});
|
||||
OptionPill({required this.text, required this.selected});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@ import 'package:satu/shared/ui_helpers.dart';
|
|||
import 'package:satu/views/add_by_barcode/add_by_barcode_view.dart';
|
||||
|
||||
class ProductListItem extends StatefulWidget {
|
||||
final String name;
|
||||
final String ean;
|
||||
final String categoryName;
|
||||
final num price;
|
||||
final num count;
|
||||
final bool isOdd;
|
||||
final int transactionId;
|
||||
final String? name;
|
||||
final String? ean;
|
||||
final String? categoryName;
|
||||
final num? price;
|
||||
final num? count;
|
||||
final bool? isOdd;
|
||||
final int? transactionId;
|
||||
|
||||
const ProductListItem(
|
||||
{Key key, this.name, this.ean, this.categoryName, this.price, this.count, this.isOdd, this.transactionId})
|
||||
{Key? key, this.name, this.ean, this.categoryName, this.price, this.count, this.isOdd, this.transactionId})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
|
|
@ -73,9 +73,9 @@ class _ProductListItemState extends State<ProductListItem> {
|
|||
},
|
||||
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 ?? ''),
|
||||
child: ListTile(
|
||||
onTap: () => _onItemTapped(context),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0),
|
||||
|
|
@ -91,7 +91,7 @@ class _ProductListItemState extends State<ProductListItem> {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
widget.name,
|
||||
widget.name ?? '',
|
||||
style: const TextStyle(fontWeight: FontWeight.w500),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 2,
|
||||
|
|
@ -127,7 +127,7 @@ class _ProductListItemState extends State<ProductListItem> {
|
|||
],
|
||||
),
|
||||
),
|
||||
tileColor: !widget.isOdd ? fillColor : backgroundColor,
|
||||
tileColor: !widget.isOdd! ? fillColor : backgroundColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ import 'package:satu/shared/app_colors.dart';
|
|||
import 'package:satu/views/work/tabs/component/products_header_bar.dart';
|
||||
|
||||
class ProductsAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
final String title;
|
||||
final List<Widget> actions;
|
||||
final Widget child;
|
||||
final int childHeight;
|
||||
final num elevation;
|
||||
final Color backgroundColor;
|
||||
final String? title;
|
||||
final List<Widget>? actions;
|
||||
final Widget? child;
|
||||
final int? childHeight;
|
||||
final double elevation;
|
||||
final Color? backgroundColor;
|
||||
|
||||
const ProductsAppBar({Key key, this.title, this.actions, this.child,this.childHeight = 0, this.elevation = 0.0, this.backgroundColor = Colors.transparent }) : super(key: key);
|
||||
const ProductsAppBar({Key? key, this.title, this.actions, this.child,this.childHeight = 0, this.elevation = 0.0, this.backgroundColor = Colors.transparent }) : super(key: key);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
|
|
@ -21,20 +21,20 @@ class ProductsAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||
child: Column(
|
||||
children: [
|
||||
AppBar(
|
||||
title: Text(title),
|
||||
title: Text(title ?? ''),
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0.0,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.menu, color: yellowColor,),
|
||||
onPressed: () {
|
||||
locator<NavigatorService>().scaffoldDrawerKey.currentState.openDrawer();
|
||||
locator<NavigatorService>().scaffoldDrawerKey.currentState!.openDrawer();
|
||||
},
|
||||
),
|
||||
actions: actions
|
||||
,
|
||||
),
|
||||
if(child !=null && childHeight > 0)
|
||||
child,
|
||||
if(child !=null && childHeight! > 0)
|
||||
child!,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
@ -42,6 +42,6 @@ class ProductsAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||
|
||||
@override
|
||||
Size get preferredSize {
|
||||
return new Size.fromHeight(60.0 + childHeight);
|
||||
return new Size.fromHeight(60.0 + childHeight!);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
|
|||
import 'package:satu/shared/app_colors.dart';
|
||||
import 'package:satu/shared/shared_styles.dart';
|
||||
import 'package:satu/widgets/dialog/modal_select_dialog.dart';
|
||||
import 'package:searchable_dropdown/searchable_dropdown.dart';
|
||||
|
||||
|
||||
class ProductHeaderBar extends StatelessWidget {
|
||||
final int count;
|
||||
final num sum;
|
||||
|
||||
const ProductHeaderBar({Key key, this.count, this.sum}) : super(key: key);
|
||||
const ProductHeaderBar({Key? key, required this.count, required this.sum}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -37,20 +37,21 @@ class ProductHeaderBar extends StatelessWidget {
|
|||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return DropdownDialog(
|
||||
dialogBox: true,
|
||||
multipleSelection: false,
|
||||
items: <String>['Частное лицо', 'ИП Иванов', 'ТО "Рога и копыта"', 'Network Energy']
|
||||
.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
selectedItems: selected,
|
||||
hint: Text('Выберите контрагента'),
|
||||
closeButton: 'Отмена',
|
||||
);
|
||||
return Container();
|
||||
// return DropdownDialog(
|
||||
// dialogBox: true,
|
||||
// multipleSelection: false,
|
||||
// items: <String>['Частное лицо', 'ИП Иванов', 'ТО "Рога и копыта"', 'Network Energy']
|
||||
// .map<DropdownMenuItem<String>>((String value) {
|
||||
// return DropdownMenuItem<String>(
|
||||
// value: value,
|
||||
// child: Text(value),
|
||||
// );
|
||||
// }).toList(),
|
||||
// selectedItems: selected,
|
||||
// hint: Text('Выберите контрагента'),
|
||||
// closeButton: 'Отмена',
|
||||
// );
|
||||
}).then((value) => {
|
||||
print(selected)
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class TransactionItem extends StatelessWidget {
|
|||
final String amount;
|
||||
final bool received;
|
||||
|
||||
TransactionItem({@required this.fullName, @required this.status, @required this.amount, @required this.received});
|
||||
TransactionItem({required this.fullName, required this.status, required this.amount, required this.received});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class SellView extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StoreConnector<AppState, SellState>(
|
||||
converter: (store) => store.state.sellState,
|
||||
converter: (store) => store.state.sellState!,
|
||||
builder: (_, state) {
|
||||
return Scaffold(
|
||||
appBar: ProductsAppBar(
|
||||
|
|
@ -30,17 +30,17 @@ class SellView extends StatelessWidget {
|
|||
actions: actions(),
|
||||
elevation: 2.0,
|
||||
child: ProductHeaderBar(
|
||||
count: state.items.length,
|
||||
sum: sumProducts(state.items),
|
||||
count: state.items!.length,
|
||||
sum: sumProducts(state.items!),
|
||||
),
|
||||
backgroundColor: backgroundColor,
|
||||
childHeight: 80,
|
||||
),
|
||||
body: ListView.builder(
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemCount: state.items.length,
|
||||
itemCount: state.items!.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
ProductDao product = state.items.elementAt(index);
|
||||
ProductDao product = state.items!.elementAt(index);
|
||||
return ProductListItem(
|
||||
key: UniqueKey(),
|
||||
ean: product.eanCode,
|
||||
|
|
@ -61,7 +61,7 @@ class SellView extends StatelessWidget {
|
|||
|
||||
Widget floatingActionButtonRender() {
|
||||
return StoreConnector<AppState, SellState>(
|
||||
converter: (store) => store.state.sellState,
|
||||
converter: (store) => store.state.sellState!,
|
||||
builder: (_, snapshot) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 16.0),
|
||||
|
|
@ -70,7 +70,7 @@ class SellView extends StatelessWidget {
|
|||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Visibility(
|
||||
visible: snapshot.items.isNotEmpty,
|
||||
visible: snapshot.items!.isNotEmpty,
|
||||
child: FloatingActionButton(
|
||||
elevation: 2,
|
||||
backgroundColor: greenColor,
|
||||
|
|
@ -111,7 +111,7 @@ class SellView extends StatelessWidget {
|
|||
child: IconButton(
|
||||
icon: Icon(Icons.delete, size: 30.0, color: yellowColor),
|
||||
onPressed: () {
|
||||
Redux.store.dispatch(removeAllSellData);
|
||||
Redux.store!.dispatch(removeAllSellData);
|
||||
}),
|
||||
)
|
||||
];
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ num sumProducts(List<ProductDao> list) {
|
|||
num result = 0.0;
|
||||
if (list.isNotEmpty) {
|
||||
list.forEach((product) {
|
||||
result += (product.price * product.count);
|
||||
result += (product.price! * product.count!);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
|
||||
import 'package:satu/core/redux/actions/sell_actions.dart';
|
||||
import 'package:satu/core/redux/store.dart';
|
||||
import 'package:satu/shared/app_colors.dart';
|
||||
|
|
@ -8,9 +9,9 @@ import 'package:satu/views/work/tabs/journal_view.dart';
|
|||
import 'package:satu/views/work/tabs/sell_view.dart';
|
||||
|
||||
class WorkView extends StatefulWidget {
|
||||
final String text;
|
||||
final String? text;
|
||||
|
||||
const WorkView({Key key, this.text}) : super(key: key);
|
||||
const WorkView({Key? key, this.text}) : super(key: key);
|
||||
@override
|
||||
_WorkViewState createState() => _WorkViewState();
|
||||
}
|
||||
|
|
@ -30,7 +31,7 @@ class _WorkViewState extends State<WorkView> {
|
|||
void initState() {
|
||||
super.initState();
|
||||
// state sell view
|
||||
Redux.store.dispatch(loadSellData);
|
||||
Redux.store!.dispatch(loadSellData);
|
||||
}
|
||||
|
||||
void _onItemTapped(int index) {
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@ class AmanIconButton extends StatefulWidget {
|
|||
final bool busy;
|
||||
final String title;
|
||||
final Function onPressed;
|
||||
final bool enabled;
|
||||
final bool? enabled;
|
||||
final Color mainColor;
|
||||
final IconData icon;
|
||||
const AmanIconButton(
|
||||
{
|
||||
@required this.title,
|
||||
required this.title,
|
||||
this.busy = false,
|
||||
@required this.onPressed,
|
||||
required this.onPressed,
|
||||
this.enabled = true,
|
||||
this.mainColor,
|
||||
@required this.icon
|
||||
required this.mainColor,
|
||||
required this.icon
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -31,7 +31,11 @@ class _AmanIconButtonState extends State<AmanIconButton> {
|
|||
return GestureDetector(
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
onTap: widget.busy ? () {} : widget.onPressed,
|
||||
onTap: () {
|
||||
if(!widget.busy) {
|
||||
widget.onPressed();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
//height: 75,
|
||||
width: 120,
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ class BusyButton extends StatefulWidget {
|
|||
final String title;
|
||||
final Function onPressed;
|
||||
final bool enabled;
|
||||
final Color mainColor;
|
||||
final Color? mainColor;
|
||||
|
||||
const BusyButton({
|
||||
@required this.title,
|
||||
required this.title,
|
||||
this.busy = false,
|
||||
@required this.onPressed,
|
||||
required this.onPressed,
|
||||
this.enabled = true,
|
||||
this.mainColor,
|
||||
});
|
||||
|
|
@ -38,7 +38,10 @@ class _BusyButtonState extends State<BusyButton> {
|
|||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
onTap: widget.busy || !widget.enabled ? null : widget.onPressed,
|
||||
onTap: () {
|
||||
if(!(widget.busy || !widget.enabled))
|
||||
widget.onPressed();
|
||||
},
|
||||
child: AnimatedContainer(
|
||||
height: widget.busy ? 45 : 45,
|
||||
//width: widget.busy ? 40 : 40,
|
||||
|
|
|
|||
|
|
@ -8,14 +8,14 @@ import 'package:satu/core/utils/locator.dart';
|
|||
class DialogManager extends StatefulWidget {
|
||||
final Widget child;
|
||||
|
||||
DialogManager({Key key, this.child}) : super(key: key);
|
||||
DialogManager({Key? key, required this.child}) : super(key: key);
|
||||
|
||||
_DialogManagerState createState() => _DialogManagerState();
|
||||
}
|
||||
|
||||
class _DialogManagerState extends State<DialogManager> {
|
||||
final DialogService _dialogService = locator<DialogService>();
|
||||
TextEditingController _controller;
|
||||
late TextEditingController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -48,24 +48,24 @@ class _DialogManagerState extends State<DialogManager> {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
request.title,
|
||||
request.title!,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
//Divider(),
|
||||
],
|
||||
),
|
||||
content: Text(request.description),
|
||||
content: Text(request.description!),
|
||||
actions: <Widget>[
|
||||
if (isConfirmationDialog)
|
||||
FlatButton(
|
||||
child: Text(request.cancelTitle),
|
||||
child: Text(request.cancelTitle!),
|
||||
onPressed: () {
|
||||
_dialogService
|
||||
.dialogComplete(DialogResponse(confirmed: false));
|
||||
},
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(request.buttonTitle),
|
||||
child: Text(request.buttonTitle!),
|
||||
onPressed: () {
|
||||
_dialogService
|
||||
.dialogComplete(DialogResponse(confirmed: true));
|
||||
|
|
@ -95,7 +95,7 @@ class _DialogManagerState extends State<DialogManager> {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
request.title,
|
||||
request.title!,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
//Divider(),
|
||||
|
|
@ -131,7 +131,7 @@ class _DialogManagerState extends State<DialogManager> {
|
|||
RaisedButton(
|
||||
//color: redColor,
|
||||
child: Text(
|
||||
request.cancelTitle,
|
||||
request.cancelTitle!,
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
onPressed: () {
|
||||
|
|
@ -145,7 +145,7 @@ class _DialogManagerState extends State<DialogManager> {
|
|||
RaisedButton(
|
||||
//color: primaryColor,
|
||||
child: Text(
|
||||
request.buttonTitle,
|
||||
request.buttonTitle!,
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
onPressed: () {
|
||||
|
|
@ -162,7 +162,7 @@ class _DialogManagerState extends State<DialogManager> {
|
|||
dialogController.whenComplete(() {
|
||||
//hook when press overlay and response not completed
|
||||
if (_dialogService.completer != null) {
|
||||
_dialogService.completer.complete(DialogResponse(confirmed: false));
|
||||
_dialogService.completer!.complete(DialogResponse(confirmed: false));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class DialogModalSelect extends StatefulWidget {
|
||||
final String title;
|
||||
final String descriptions;
|
||||
final String text;
|
||||
final String? title;
|
||||
final String? descriptions;
|
||||
final String? text;
|
||||
|
||||
const DialogModalSelect({Key key, this.title, this.descriptions, this.text})
|
||||
const DialogModalSelect({Key? key, this.title, this.descriptions, this.text})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
|
|
@ -50,14 +50,14 @@ class _DialogModalSelectState extends State<DialogModalSelect> {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget.title,
|
||||
widget.title ?? '',
|
||||
style: TextStyle(fontSize: 22, fontWeight: FontWeight.w600),
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Text(
|
||||
widget.descriptions,
|
||||
widget.descriptions ?? '',
|
||||
style: TextStyle(fontSize: 14),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
|
|
@ -71,7 +71,7 @@ class _DialogModalSelectState extends State<DialogModalSelect> {
|
|||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text(
|
||||
widget.text,
|
||||
widget.text ?? '',
|
||||
style: TextStyle(fontSize: 18),
|
||||
)),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:satu/core/redux/actions/nav_actions.dart';
|
||||
import 'package:satu/core/redux/actions/user_actions.dart';
|
||||
import 'package:satu/core/redux/store.dart';
|
||||
import 'package:satu/core/services/api_service.dart';
|
||||
import 'package:satu/core/utils/locator.dart';
|
||||
|
||||
import 'package:satu/shared/app_colors.dart';
|
||||
import 'package:satu/shared/ui_helpers.dart';
|
||||
import 'package:satu/views/settings/setting_view.dart';
|
||||
|
|
@ -20,7 +19,7 @@ class AppDrawer extends StatelessWidget {
|
|||
_createHeader(),
|
||||
_createDrawerItem(icon: Icons.contacts, text: 'Касса', onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
Redux.store.dispatch(navigateDrawer(WorkView));
|
||||
Redux.store!.dispatch(navigateDrawer(WorkView));
|
||||
}),
|
||||
Divider(),
|
||||
ExpansionTile(
|
||||
|
|
@ -49,13 +48,13 @@ class AppDrawer extends StatelessWidget {
|
|||
),
|
||||
_createDrawerItem(icon: Icons.settings, text: 'Настройки', onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
Redux.store.dispatch(navigateDrawer(SettingsView));
|
||||
Redux.store!.dispatch(navigateDrawer(SettingsView));
|
||||
}),
|
||||
Divider(),
|
||||
_createDrawerItem(icon: Icons.bug_report, text: 'Сообщить об ошибке'),
|
||||
verticalSpaceMedium,
|
||||
_createDrawerItem(icon: Icons.exit_to_app, text: 'Выйти из аккаунта', onTap: () async {
|
||||
Redux.store.dispatch(logout);
|
||||
Redux.store!.dispatch(logout);
|
||||
}),
|
||||
ListTile(
|
||||
title: Text('0.0.1'),
|
||||
|
|
@ -91,7 +90,7 @@ class AppDrawer extends StatelessWidget {
|
|||
}
|
||||
|
||||
Widget _createDrawerItem(
|
||||
{IconData icon, String text, GestureTapCallback onTap}) {
|
||||
{required IconData icon, required String text, GestureTapCallback? onTap}) {
|
||||
return ListTile(
|
||||
title: Row(
|
||||
children: <Widget>[
|
||||
|
|
|
|||
|
|
@ -3,25 +3,25 @@ import 'package:flutter/services.dart';
|
|||
import 'package:satu/shared/app_colors.dart';
|
||||
import 'package:satu/shared/shared_styles.dart';
|
||||
import 'package:satu/shared/ui_helpers.dart';
|
||||
import 'package:searchable_dropdown/searchable_dropdown.dart';
|
||||
|
||||
|
||||
import 'note_text.dart';
|
||||
|
||||
class DropDownField extends StatefulWidget {
|
||||
final bool isReadOnly;
|
||||
final String placeholder;
|
||||
final String validationMessage;
|
||||
final String? validationMessage;
|
||||
final bool smallVersion;
|
||||
final FocusNode fieldFocusNode;
|
||||
final FocusNode nextFocusNode;
|
||||
final String additionalNote;
|
||||
final Function(String) onChanged;
|
||||
final String initialValue;
|
||||
final String labelText;
|
||||
final FocusNode? fieldFocusNode;
|
||||
final FocusNode? nextFocusNode;
|
||||
final String? additionalNote;
|
||||
final Function(String)? onChanged;
|
||||
final String? initialValue;
|
||||
final String? labelText;
|
||||
|
||||
DropDownField(
|
||||
{
|
||||
@required this.placeholder,
|
||||
required this.placeholder,
|
||||
this.fieldFocusNode,
|
||||
this.nextFocusNode,
|
||||
this.additionalNote,
|
||||
|
|
@ -48,7 +48,7 @@ class _DropDownFieldState extends State<DropDownField> {
|
|||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
if (widget.labelText != null) NoteText(widget.labelText),
|
||||
if (widget.labelText != null) NoteText(widget.labelText ?? ''),
|
||||
Container(
|
||||
//height: widget.smallVersion ? 40 : fieldHeight,
|
||||
constraints: BoxConstraints(minHeight: widget.smallVersion ? 40 : fieldHeight),
|
||||
|
|
@ -56,39 +56,39 @@ class _DropDownFieldState extends State<DropDownField> {
|
|||
padding: fieldPadding,
|
||||
decoration: widget.isReadOnly ? disabledFieldDecoration : fieldDecoration,
|
||||
child: Expanded(
|
||||
child:
|
||||
SearchableDropdown.single(
|
||||
items: <String>['Частное лицо', 'ИП Иванов', 'ТО "Рога и копыта"', 'Network Energy']
|
||||
.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
value: widget.initialValue,
|
||||
readOnly: widget.isReadOnly,
|
||||
hint: "Контрагент",
|
||||
searchHint: "Укажите контрагента",
|
||||
underline: Container(
|
||||
height: 1.0,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(bottom: BorderSide(color: yellowColor, width: 3.0))
|
||||
),
|
||||
),
|
||||
onChanged: (value) {
|
||||
print(value);
|
||||
},
|
||||
isExpanded: true,
|
||||
),
|
||||
child: Container()
|
||||
// SearchableDropdown.single(
|
||||
// items: <String>['Частное лицо', 'ИП Иванов', 'ТО "Рога и копыта"', 'Network Energy']
|
||||
// .map<DropdownMenuItem<String>>((String value) {
|
||||
// return DropdownMenuItem<String>(
|
||||
// value: value,
|
||||
// child: Text(value),
|
||||
// );
|
||||
// }).toList(),
|
||||
// value: widget.initialValue,
|
||||
// readOnly: widget.isReadOnly,
|
||||
// hint: "Контрагент",
|
||||
// searchHint: "Укажите контрагента",
|
||||
// underline: Container(
|
||||
// height: 1.0,
|
||||
// decoration: BoxDecoration(
|
||||
// border: Border(bottom: BorderSide(color: yellowColor, width: 3.0))
|
||||
// ),
|
||||
// ),
|
||||
// onChanged: (value) {
|
||||
// print(value);
|
||||
// },
|
||||
// isExpanded: true,
|
||||
// ),
|
||||
),
|
||||
),
|
||||
if (widget.validationMessage != null)
|
||||
NoteText(
|
||||
widget.validationMessage,
|
||||
widget.validationMessage ?? '',
|
||||
color: Colors.red,
|
||||
),
|
||||
if (widget.additionalNote != null) verticalSpace(5),
|
||||
if (widget.additionalNote != null) NoteText(widget.additionalNote),
|
||||
if (widget.additionalNote != null) NoteText(widget.additionalNote ?? ''),
|
||||
verticalSpaceSmall
|
||||
],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -13,23 +13,23 @@ class InputField extends StatefulWidget {
|
|||
final bool search;
|
||||
final bool isReadOnly;
|
||||
final String placeholder;
|
||||
final String validationMessage;
|
||||
final Function enterPressed;
|
||||
final String? validationMessage;
|
||||
final Function? enterPressed;
|
||||
final bool smallVersion;
|
||||
final FocusNode fieldFocusNode;
|
||||
final FocusNode nextFocusNode;
|
||||
final FocusNode? fieldFocusNode;
|
||||
final FocusNode? nextFocusNode;
|
||||
final TextInputAction textInputAction;
|
||||
final bool multiline;
|
||||
final String additionalNote;
|
||||
final Function(String) onChanged;
|
||||
final TextInputFormatter formatter;
|
||||
final String initialValue;
|
||||
final String labelText;
|
||||
final String? additionalNote;
|
||||
final Function(String)? onChanged;
|
||||
final TextInputFormatter? formatter;
|
||||
final String? initialValue;
|
||||
final String? labelText;
|
||||
|
||||
InputField(
|
||||
{
|
||||
this.controller,
|
||||
@required this.placeholder,
|
||||
required this.controller,
|
||||
required this.placeholder,
|
||||
this.enterPressed,
|
||||
this.fieldFocusNode,
|
||||
this.nextFocusNode,
|
||||
|
|
@ -51,8 +51,8 @@ class InputField extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _InputFieldState extends State<InputField> {
|
||||
bool isPassword;
|
||||
bool isSearch;
|
||||
late bool isPassword;
|
||||
late bool isSearch;
|
||||
double fieldHeight = 55;
|
||||
|
||||
@override
|
||||
|
|
@ -61,8 +61,8 @@ class _InputFieldState extends State<InputField> {
|
|||
isPassword = widget.password;
|
||||
isSearch = widget.search;
|
||||
if(widget.search == true) {
|
||||
widget.fieldFocusNode.addListener(() {
|
||||
if(widget.fieldFocusNode.hasFocus){
|
||||
widget.fieldFocusNode!.addListener(() {
|
||||
if(widget.fieldFocusNode!.hasFocus){
|
||||
setState(() {
|
||||
isSearch = !isSearch;
|
||||
});
|
||||
|
|
@ -76,7 +76,7 @@ class _InputFieldState extends State<InputField> {
|
|||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
if (widget.labelText != null) NoteText(widget.labelText),
|
||||
if (widget.labelText != null) NoteText(widget.labelText ?? ''),
|
||||
Container(
|
||||
//height: widget.smallVersion ? 40 : fieldHeight,
|
||||
constraints: BoxConstraints(minHeight: widget.smallVersion ? 40 : fieldHeight),
|
||||
|
|
@ -97,16 +97,16 @@ class _InputFieldState extends State<InputField> {
|
|||
onChanged: widget.onChanged,
|
||||
initialValue: widget.initialValue,
|
||||
inputFormatters:
|
||||
widget.formatter != null ? [widget.formatter] : null,
|
||||
widget.formatter != null ? [widget.formatter!] : null,
|
||||
onEditingComplete: () {
|
||||
if (widget.enterPressed != null) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
widget.enterPressed();
|
||||
widget.enterPressed!();
|
||||
}
|
||||
},
|
||||
onFieldSubmitted: (value) {
|
||||
if (widget.nextFocusNode != null) {
|
||||
widget.nextFocusNode.requestFocus();
|
||||
widget.nextFocusNode!.requestFocus();
|
||||
}
|
||||
},
|
||||
obscureText: isPassword,
|
||||
|
|
@ -137,10 +137,10 @@ class _InputFieldState extends State<InputField> {
|
|||
GestureDetector(
|
||||
onTap: () {
|
||||
if(isSearch) {
|
||||
widget.fieldFocusNode.requestFocus();
|
||||
widget.fieldFocusNode!.requestFocus();
|
||||
} else {
|
||||
FocusScope.of(context).requestFocus(new FocusNode()); //remove focus
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => widget.controller.clear()); // clear content
|
||||
WidgetsBinding.instance!.addPostFrameCallback((_) => widget.controller.clear()); // clear content
|
||||
}
|
||||
setState(() {
|
||||
isSearch = !isSearch;
|
||||
|
|
@ -161,11 +161,11 @@ class _InputFieldState extends State<InputField> {
|
|||
),
|
||||
if (widget.validationMessage != null)
|
||||
NoteText(
|
||||
widget.validationMessage,
|
||||
widget.validationMessage ?? '',
|
||||
color: Colors.red,
|
||||
),
|
||||
if (widget.additionalNote != null) verticalSpace(5),
|
||||
if (widget.additionalNote != null) NoteText(widget.additionalNote),
|
||||
if (widget.additionalNote != null) NoteText(widget.additionalNote ?? ''),
|
||||
verticalSpaceSmall
|
||||
],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import 'package:satu/shared/app_colors.dart';
|
|||
|
||||
class NoteText extends StatelessWidget {
|
||||
final String text;
|
||||
final TextAlign textAlign;
|
||||
final Color color;
|
||||
final double fontSize;
|
||||
final TextAlign? textAlign;
|
||||
final Color? color;
|
||||
final double? fontSize;
|
||||
const NoteText(this.text, {this.textAlign, this.color, this.fontSize});
|
||||
|
||||
@override
|
||||
|
|
|
|||
167
pubspec.lock
167
pubspec.lock
|
|
@ -1,41 +1,20 @@
|
|||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: archive
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.13"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.0"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.5.0"
|
||||
version: "2.6.1"
|
||||
auto_size_text:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: auto_size_text
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
barcode_scan:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: barcode_scan
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "3.0.0-nullsafety.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -78,62 +57,41 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: convert
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
csslib:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: csslib
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.16.2"
|
||||
version: "3.0.1"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: cupertino_icons
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
version: "1.0.3"
|
||||
device_info:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: device_info
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.2"
|
||||
device_info_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: device_info_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.1"
|
||||
equatable:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: equatable
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
esc_pos_utils:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: esc_pos_utils
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
version: "2.0.3"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -147,21 +105,14 @@ packages:
|
|||
name: ffi
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
version: "1.1.2"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.1.0"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fixnum
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.10.11"
|
||||
version: "6.1.2"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
|
|
@ -180,7 +131,7 @@ packages:
|
|||
name: flutter_screenutil
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.0.0"
|
||||
version: "5.0.0+2"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
|
|
@ -191,34 +142,13 @@ packages:
|
|||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
gbk_codec:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: gbk_codec
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.2"
|
||||
get_it:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: get_it
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "7.1.2"
|
||||
hex:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: hex
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.2"
|
||||
html:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: html
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.14.0+4"
|
||||
version: "7.1.3"
|
||||
http:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -233,13 +163,6 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
image:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.19"
|
||||
implicitly_animated_reorderable_list:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -274,7 +197,7 @@ packages:
|
|||
name: mask_text_input_formatter
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
version: "2.0.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -288,7 +211,7 @@ packages:
|
|||
name: material_design_icons_flutter
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.5955"
|
||||
version: "5.0.5955-rc.1"
|
||||
material_floating_search_bar:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -323,7 +246,7 @@ packages:
|
|||
name: path_provider
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
version: "2.0.2"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -344,7 +267,7 @@ packages:
|
|||
name: path_provider_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.1"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -358,14 +281,7 @@ packages:
|
|||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.11.0"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: petitparser
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
version: "1.11.1"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -379,7 +295,7 @@ packages:
|
|||
name: plugin_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
version: "2.0.0"
|
||||
process:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -387,13 +303,6 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.2.1"
|
||||
protobuf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: protobuf
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -407,7 +316,7 @@ packages:
|
|||
name: qr
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.1.0"
|
||||
qr_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -450,20 +359,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.1"
|
||||
searchable_dropdown:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: searchable_dropdown
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.3"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: shared_preferences
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
version: "2.0.6"
|
||||
shared_preferences_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -510,7 +412,7 @@ packages:
|
|||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
version: "1.8.1"
|
||||
sqflite:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -566,7 +468,7 @@ packages:
|
|||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.19"
|
||||
version: "0.3.0"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -580,49 +482,49 @@ packages:
|
|||
name: url_launcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.7.10"
|
||||
version: "6.0.7"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_linux
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.1+4"
|
||||
version: "2.0.0"
|
||||
url_launcher_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.1+9"
|
||||
version: "2.0.0"
|
||||
url_launcher_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.9"
|
||||
version: "2.0.3"
|
||||
url_launcher_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.5+1"
|
||||
version: "2.0.1"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.1+3"
|
||||
version: "2.0.0"
|
||||
uuid:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: uuid
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.2"
|
||||
version: "3.0.4"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -636,7 +538,7 @@ packages:
|
|||
name: win32
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
version: "2.2.4"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -644,13 +546,6 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
xml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.5.1"
|
||||
sdks:
|
||||
dart: ">=2.12.0 <3.0.0"
|
||||
flutter: ">=1.24.0-10"
|
||||
dart: ">=2.13.0 <3.0.0"
|
||||
flutter: ">=2.0.0"
|
||||
|
|
|
|||
15
pubspec.yaml
15
pubspec.yaml
|
|
@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.7.0 <3.0.0"
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
|
@ -41,21 +41,18 @@ dependencies:
|
|||
http: ^0.13.3
|
||||
sqflite: ^2.0.0+3
|
||||
path_provider: ^2.0.1
|
||||
material_design_icons_flutter: ^4.0.5955
|
||||
material_design_icons_flutter: 5.0.5955-rc.1
|
||||
intl: ^0.17.0
|
||||
barcode_scan: ^3.0.1
|
||||
device_info: ^2.0.0
|
||||
auto_size_text: ^2.1.0
|
||||
url_launcher: ^5.7.10
|
||||
auto_size_text: ^3.0.0-nullsafety.0
|
||||
url_launcher: ^6.0.7
|
||||
qr_flutter: ^4.0.0
|
||||
mask_text_input_formatter: ^1.2.1
|
||||
mask_text_input_formatter: ^2.0.0
|
||||
flutter_screenutil: ^5.0.0
|
||||
shared_preferences: ^2.0.5
|
||||
searchable_dropdown: ^1.1.3
|
||||
material_floating_search_bar: ^0.3.4
|
||||
implicitly_animated_reorderable_list: ^0.4.0
|
||||
esc_pos_utils: ^1.0.0
|
||||
uuid: ^2.2.2 #for esc_pos_utils: ^1.0.0
|
||||
uuid: ^3.0.4
|
||||
charset_converter: ^2.0.0
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
|||
Loading…
Reference in New Issue