null-safety-migration

null-safety-migration
suvaissov 2021-06-25 21:29:19 +06:00
parent b1bd0101a2
commit 036a4e0d87
55 changed files with 506 additions and 609 deletions

View File

@ -3,9 +3,11 @@ import 'package:logger/logger.dart';
import '../utils/logger.dart'; import '../utils/logger.dart';
class BaseService { class BaseService {
Logger log; Logger log = getLogger(
'BaseService',
);
BaseService({String title}) { BaseService({String? title}) {
this.log = getLogger( this.log = getLogger(
title ?? this.runtimeType.toString(), title ?? this.runtimeType.toString(),
); );

View File

@ -6,11 +6,11 @@ const String CategoryColumnAppCompanyId = 'app_company_id';
const String CategoryColumnUpdatedAt = 'updated_at'; const String CategoryColumnUpdatedAt = 'updated_at';
class Category { class Category {
int id; int? id;
int parentId; int? parentId;
String name; String? name;
int appCompanyId; int? appCompanyId;
String updatedAt; String? updatedAt;
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
var map = <String, dynamic>{ var map = <String, dynamic>{

View File

@ -12,17 +12,17 @@ const String GoodColumnUpdatedAt = 'updated_at';
const String GoodColumnAppCompanyId = 'app_company_id'; const String GoodColumnAppCompanyId = 'app_company_id';
class Good { class Good {
int id; int? id;
int categoryId; int? categoryId;
String name; String? name;
String ean; String? ean;
int articul; int? articul;
num price; num? price;
num optPrice; num? optPrice;
num basePrice; num? basePrice;
int divisible; int? divisible;
String updatedAt; String? updatedAt;
int appCompanyId; int? appCompanyId;
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
var map = <String, dynamic>{ var map = <String, dynamic>{

View File

@ -14,13 +14,13 @@ const int TransactionStatusPrepare = 0;
class Transaction { class Transaction {
int id; int? id;
String uuid; String? uuid;
int type; int? type;
int status; int? status;
String data; String? data;
int appCompanyId; int? appCompanyId;
String createdAt; String? createdAt;
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
var map = <String, dynamic>{ var map = <String, dynamic>{

View File

@ -8,17 +8,17 @@
/// operation : true /// operation : true
class AuthResponse { class AuthResponse {
int userId; int? userId;
int companyId; int? companyId;
int kassaId; int? kassaId;
String token; String? token;
String authAt; String? authAt;
int shard; int? shard;
String message; String? message;
bool operation; bool? operation;
static AuthResponse fromMap(Map<String, dynamic> map) { static AuthResponse? fromMap(Map<String, dynamic> map) {
if (map == null) return null; if (map == null) return null;
AuthResponse authResponseBean = AuthResponse(); AuthResponse authResponseBean = AuthResponse();
authResponseBean.userId = map['user_id']; authResponseBean.userId = map['user_id'];

View File

@ -1,11 +1,11 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
class DialogRequest { class DialogRequest {
final String title; final String? title;
final String description; final String? description;
final String buttonTitle; final String? buttonTitle;
final String cancelTitle; final String? cancelTitle;
final String formatType; final String? formatType;
DialogRequest( DialogRequest(
{@required this.title, {@required this.title,
@ -18,8 +18,8 @@ class DialogRequest {
class DialogResponse { class DialogResponse {
//final String fieldOne; //final String fieldOne;
//final String fieldTwo; //final String fieldTwo;
final String responseText; final String? responseText;
final bool confirmed; final bool? confirmed;
DialogResponse({ DialogResponse({
//this.fieldOne, //this.fieldOne,

View File

@ -4,12 +4,12 @@
/// updated_at : "2021-01-06 14:20:47" /// updated_at : "2021-01-06 14:20:47"
class CategoryResponse { class CategoryResponse {
int id; int? id;
int parentId; int? parentId;
String name; String? name;
String updatedAt; String? updatedAt;
static CategoryResponse fromMap(Map<String, dynamic> map) { static CategoryResponse? fromMap(Map<String, dynamic> map) {
if (map == null) return null; if (map == null) return null;
CategoryResponse categoryResponseBean = CategoryResponse(); CategoryResponse categoryResponseBean = CategoryResponse();
categoryResponseBean.id = map['id']; categoryResponseBean.id = map['id'];

View File

@ -10,18 +10,18 @@
/// updated_at : "2021-02-03 11:37:34" /// updated_at : "2021-02-03 11:37:34"
class GoodResponse { class GoodResponse {
int id; int? id;
int categoryId; int? categoryId;
String name; String? name;
String ean; String? ean;
int articul; int? articul;
int price; int? price;
int optPrice; int? optPrice;
int basePrice; int? basePrice;
int divisible; int? divisible;
String updatedAt; String? updatedAt;
static GoodResponse fromMap(Map<String, dynamic> map) { static GoodResponse? fromMap(Map<String, dynamic> map) {
if (map == null) return null; if (map == null) return null;
GoodResponse goodResponseBean = GoodResponse(); GoodResponse goodResponseBean = GoodResponse();
goodResponseBean.id = map['id']; goodResponseBean.id = map['id'];

View File

@ -1,14 +1,14 @@
class ProductDao { class ProductDao {
int id; int? id;
int categoryId; int? categoryId;
num count; num? count;
num price; num? price;
String productName; String? productName;
String categoryName; String? categoryName;
String eanCode; String? eanCode;
int article; int? article;
String excise; String? excise;
int transactionId; int? transactionId;
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {

View File

@ -1,3 +1,3 @@
class TransactionState { class TransactionState {
String uuid; String? uuid;
} }

View File

@ -2,17 +2,16 @@
/// message : "" /// message : ""
/// operation : true /// operation : true
class Response<T> { class Response {
List<T> list; List? list;
String message; String? message;
bool operation; bool? operation;
Response(); Response();
factory Response.fromMapList(Map<String, dynamic> map, Function parser) { factory Response.fromMapList(Map<String, dynamic> map, Function? parser) {
if (map == null) return null;
List<T> list = []; List list = [];
if (map['list'] != null) { if (map['list'] != null) {
(map['list'] as List).forEach((element) { (map['list'] as List).forEach((element) {
if(parser == null) if(parser == null)

View File

@ -28,15 +28,15 @@ final Logger log = getLogger('SetSellStateAction');
final DbService _dbService = locator<DbService>(); 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 { return (Store<AppState> store) async {
log.i('addSellItem'); log.i('addSellItem');
int appCompanyId = store.state.userState.auth.companyId; int? appCompanyId = store.state.userState!.auth!.companyId;
String uuid = store.state.sellState.transactionState.uuid; String? uuid = store.state.sellState!.transactionState!.uuid;
Transaction transaction; Transaction? transaction;
if (uuid != null && good != null) { if (uuid != null ) {
List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere( List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere(
TransactionTableName, TransactionTableName,
'$TransactionColumnAppCompanyId = ? and $TransactionColumnStatus = ? and ${TransactionColumnType} = ?', '$TransactionColumnAppCompanyId = ? and $TransactionColumnStatus = ? and ${TransactionColumnType} = ?',
@ -45,7 +45,7 @@ ThunkAction<AppState> addSellItem({Good good, String excise}) {
if (set.isNotEmpty) { if (set.isNotEmpty) {
for (Map<String, dynamic> map in set) { for (Map<String, dynamic> map in set) {
Transaction _transaction = Transaction.fromMap(map); Transaction _transaction = Transaction.fromMap(map);
ProductDao _product = ProductDao.fromMap(jsonDecode(_transaction.data)); ProductDao _product = ProductDao.fromMap(jsonDecode(_transaction.data!));
if (_product.id == good.id && _product.excise == excise) { if (_product.id == good.id && _product.excise == excise) {
transaction = _transaction; transaction = _transaction;
break; break;
@ -55,8 +55,8 @@ ThunkAction<AppState> addSellItem({Good good, String excise}) {
} }
if (transaction != null) { if (transaction != null) {
ProductDao item = ProductDao.fromMap(jsonDecode(transaction.data)); ProductDao item = ProductDao.fromMap(jsonDecode(transaction.data!));
item..count = item.count + 1; item..count = item.count! + 1;
transaction.data = jsonEncode(item.toMap()); transaction.data = jsonEncode(item.toMap());
transaction.createdAt = DateTime.now().toIso8601String(); transaction.createdAt = DateTime.now().toIso8601String();
_dbService.update(TransactionTableName, transaction.toMap()); _dbService.update(TransactionTableName, transaction.toMap());
@ -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 { return (Store<AppState> store) async {
int appCompanyId = store.state.userState.auth.companyId; int? appCompanyId = store.state.userState!.auth!.companyId;
String uuid = store.state.sellState.transactionState.uuid; String? uuid = store.state.sellState!.transactionState!.uuid;
int count = await _dbService.delete(TransactionTableName, transactionId); int count = await _dbService.delete(TransactionTableName, transactionId);
log.i('removeSellItem ${count} by transactionId:${transactionId}'); log.i('removeSellItem ${count} by transactionId:${transactionId}');
@ -131,8 +131,8 @@ ThunkAction<AppState> removeSellItem({int transactionId}) {
Future<void> removeAllSellData(Store<AppState> store) async { Future<void> removeAllSellData(Store<AppState> store) async {
try { try {
log.i('removeAllSellData'); log.i('removeAllSellData');
int appCompanyId = store.state.userState.auth.companyId; int? appCompanyId = store.state.userState!.auth!.companyId;
String uuid = store.state.sellState.transactionState.uuid; String? uuid = store.state.sellState!.transactionState!.uuid;
await _dbService.deleteByWhere( await _dbService.deleteByWhere(
TransactionTableName, TransactionTableName,
'$TransactionColumnAppCompanyId = ? ' '$TransactionColumnAppCompanyId = ? '
@ -149,18 +149,18 @@ Future<void> removeAllSellData(Store<AppState> store) async {
Future<void> loadSellData(Store<AppState> store) async { Future<void> loadSellData(Store<AppState> store) async {
try { try {
log.i('loadSellData'); log.i('loadSellData');
int appCompanyId = store.state.userState.auth.companyId; int? appCompanyId = store.state.userState!.auth!.companyId;
List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere( List<Map<String, dynamic>> set = await _dbService.queryRowsWithWhere(
TransactionTableName, TransactionTableName,
'$TransactionColumnAppCompanyId = ? and $TransactionColumnStatus = ? and ${TransactionColumnType} = ?', '$TransactionColumnAppCompanyId = ? and $TransactionColumnStatus = ? and ${TransactionColumnType} = ?',
[appCompanyId, TransactionStatusPrepare, TransactionTypeSell], [appCompanyId, TransactionStatusPrepare, TransactionTypeSell],
orderBy: '$TransactionColumnCreatedAt desc'); orderBy: '$TransactionColumnCreatedAt desc');
List<ProductDao> list = []; List<ProductDao> list = [];
String uuid; String? uuid;
for (Map<String, dynamic> map in set) { for (Map<String, dynamic> map in set) {
Transaction transaction = Transaction.fromMap(map); Transaction transaction = Transaction.fromMap(map);
uuid = transaction.uuid; uuid = transaction.uuid;
ProductDao productDao = ProductDao.fromMap(jsonDecode(transaction.data)); ProductDao productDao = ProductDao.fromMap(jsonDecode(transaction.data!));
productDao.transactionId = transaction.id; productDao.transactionId = transaction.id;
list.add(productDao); list.add(productDao);
} }

View File

@ -29,13 +29,13 @@ ThunkAction<AppState> authenticate(String email, String password) {
store.dispatch(SetUserStateAction(UserState(isLoading: true))); store.dispatch(SetUserStateAction(UserState(isLoading: true)));
try { try {
AuthResponse result = await _api.login(email, password); AuthResponse result = await _api.login(email, password);
if (result.operation) { if ( result.operation!) {
_api.token = result.token; _api.token = result.token!;
store.dispatch(SetUserStateAction(UserState(isLoading: false, auth: result))); store.dispatch(SetUserStateAction(UserState(isLoading: false, auth: result)));
_navigation.replace(MainViewRoute); _navigation.replace(MainViewRoute);
_afterAuth(store); _afterAuth(store);
} else { } else {
_dialogService.showDialog(title: 'Внимание', buttonTitle: 'Ok', description: result.message); _dialogService.showDialog(title: 'Внимание', buttonTitle: 'Ok', description: result.message!);
} }
} catch (e) { } catch (e) {
print(e); print(e);
@ -48,13 +48,13 @@ ThunkAction<AppState> authenticate(String email, String password) {
Future<void> auth(Store<AppState> store) async { Future<void> auth(Store<AppState> store) async {
store.dispatch(SetUserStateAction(UserState(isLoading: true))); store.dispatch(SetUserStateAction(UserState(isLoading: true)));
try { try {
UserState state = store.state.userState; UserState? state = store.state.userState;
if(state.auth.operation == false) { if(state!.auth!.operation == false) {
_navigation.replace(LoginViewRoute); _navigation.replace(LoginViewRoute);
} else { } else {
AuthResponse response = await _api.auth(state.auth.token); AuthResponse response = await _api.auth(state.auth!.token!);
if(response.operation){ if(response.operation!){
_api.token = response.token; _api.token = response.token!;
_navigation.replace(MainViewRoute); _navigation.replace(MainViewRoute);
_afterAuth(store); _afterAuth(store);
} else { } else {
@ -72,12 +72,12 @@ Future<void> logout(Store<AppState> store) async {
store.dispatch(SetUserStateAction(UserState(isLoading: true))); store.dispatch(SetUserStateAction(UserState(isLoading: true)));
try { try {
AuthResponse result = await _api.logout(); AuthResponse result = await _api.logout();
if (result.operation) { if (result.operation!) {
_api.token = null; _api.token = null;
store.dispatch(SetUserStateAction(UserState(isLoading: false, auth: AuthResponse()))); store.dispatch(SetUserStateAction(UserState(isLoading: false, auth: AuthResponse())));
_navigation.replace(LoginViewRoute); _navigation.replace(LoginViewRoute);
} else { } else {
_dialogService.showDialog(title: 'Внимание', buttonTitle: 'Ok', description: result.message); _dialogService.showDialog(title: 'Внимание', buttonTitle: 'Ok', description: result.message!);
} }
} catch (e) { } catch (e) {
print(e); print(e);

View File

@ -6,7 +6,7 @@ import 'package:satu/core/redux/state/user_state.dart';
navReducer(NavState prevState, SetNavStateAction action) { navReducer(NavState prevState, SetNavStateAction action) {
final payload = action.navState; final payload = action.navState;
return prevState.copyWith( return prevState.copyWith(
drawerViewClass: payload.drawerViewClass, drawerViewClass: payload.drawerViewClass!,
selectedTabIndex: payload.selectedTabIndex, selectedTabIndex: payload.selectedTabIndex!,
); );
} }

View File

@ -3,8 +3,8 @@ import 'package:satu/views/work/work_view.dart';
@immutable @immutable
class NavState { class NavState {
final Type drawerViewClass; final Type? drawerViewClass;
final int selectedTabIndex; final int? selectedTabIndex;
NavState({this.drawerViewClass, this.selectedTabIndex}); NavState({this.drawerViewClass, this.selectedTabIndex});
@ -14,8 +14,8 @@ class NavState {
); );
NavState copyWith({ NavState copyWith({
@required int selectedTabIndex, required int? selectedTabIndex,
@required Type drawerViewClass, required Type? drawerViewClass,
}) { }) {
return NavState( return NavState(
selectedTabIndex: selectedTabIndex ?? this.selectedTabIndex, selectedTabIndex: selectedTabIndex ?? this.selectedTabIndex,

View File

@ -5,8 +5,8 @@ import 'package:satu/core/models/flow/transaction_state.dart';
@immutable @immutable
class SellState { class SellState {
final List<ProductDao> items; final List<ProductDao>? items;
final TransactionState transactionState; final TransactionState? transactionState;
SellState({this.items, this.transactionState}); SellState({this.items, this.transactionState});
@ -15,7 +15,7 @@ class SellState {
transactionState: TransactionState(), 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); return SellState(items: items ?? this.items, transactionState: transactionState ?? this.transactionState);
} }
} }

View File

@ -5,9 +5,9 @@ import 'package:satu/core/models/auth/auth_response.dart';
@immutable @immutable
class UserState { class UserState {
final bool isError; final bool? isError;
final bool isLoading; final bool? isLoading;
final AuthResponse auth; final AuthResponse? auth;
UserState( UserState(
@ -16,16 +16,16 @@ class UserState {
this.auth, this.auth,
}); });
factory UserState.initial(UserState payload) => UserState( factory UserState.initial(UserState? payload) => UserState(
isLoading: false, isLoading: false,
isError: false, isError: false,
auth: payload?.auth ?? (AuthResponse()..operation=false), auth: payload?.auth ?? (AuthResponse()..operation=false),
); );
UserState copyWith({ UserState copyWith({
@required bool isError, required bool? isError,
@required bool isLoading, required bool? isLoading,
@required AuthResponse auth required AuthResponse? auth
}) { }) {
return UserState( return UserState(
isError: isError ?? this.isError, isError: isError ?? this.isError,
@ -34,7 +34,7 @@ class UserState {
); );
} }
static UserState fromJson(dynamic json) { static UserState? fromJson(dynamic? json) {
return json != null return json != null
? UserState( ? UserState(
auth: AuthResponse.fromMap(json['auth']), auth: AuthResponse.fromMap(json['auth']),
@ -44,7 +44,7 @@ class UserState {
dynamic toJson() { dynamic toJson() {
return { return {
"auth": auth != null ? auth.toJson() : null, "auth": auth != null ? auth!.toJson() : null,
}; };
} }
} }

View File

@ -20,15 +20,15 @@ import 'actions/user_actions.dart';
AppState appReducer(AppState state, dynamic action) { AppState appReducer(AppState state, dynamic action) {
if (action is SetUserStateAction) { if (action is SetUserStateAction) {
/** UserAction **/ /** UserAction **/
final nextState = userReducer(state.userState, action); final nextState = userReducer(state.userState!, action);
return state.copyWith(userState: nextState); return state.copyWith(userState: nextState);
} else if (action is SetNavStateAction) { } else if (action is SetNavStateAction) {
/** NavAction **/ /** NavAction **/
final nextState = navReducer(state.navState, action); final nextState = navReducer(state.navState!, action);
return state.copyWith(navState: nextState); return state.copyWith(navState: nextState);
} else if (action is SetSellStateAction) { } else if (action is SetSellStateAction) {
/** NavAction **/ /** NavAction **/
final nextState = sellReducer(state.sellState, action); final nextState = sellReducer(state.sellState!, action);
return state.copyWith(sellState: nextState); return state.copyWith(sellState: nextState);
} }
return state; return state;
@ -37,9 +37,9 @@ AppState appReducer(AppState state, dynamic action) {
//Main State //Main State
@immutable @immutable
class AppState { class AppState {
final UserState userState; final UserState? userState;
final NavState navState; final NavState? navState;
final SellState sellState; final SellState? sellState;
AppState({ AppState({
@ -50,9 +50,9 @@ class AppState {
//stable work //stable work
AppState copyWith({ AppState copyWith({
UserState userState, @required UserState? userState,
NavState navState, @required NavState? navState,
SellState sellState, @required SellState? sellState,
}) { }) {
return AppState( return AppState(
userState: userState ?? this.userState, userState: userState ?? this.userState,
@ -61,7 +61,7 @@ class AppState {
); );
} }
static AppState fromJson(dynamic json){ static AppState? fromJson(dynamic json){
return json !=null return json !=null
? AppState( ? AppState(
userState: UserState.fromJson(json['userState']), userState: UserState.fromJson(json['userState']),
@ -71,15 +71,15 @@ class AppState {
dynamic toJson() { dynamic toJson() {
return { return {
"userState" : userState.toJson(), "userState" : userState!.toJson(),
}; };
} }
} }
class Redux { class Redux {
static Store<AppState> _store; static Store<AppState>? _store;
static Store<AppState> get store { static Store<AppState>? get store {
if (_store == null) { if (_store == null) {
throw Exception("store is not initialized"); throw Exception("store is not initialized");
} else { } else {
@ -96,7 +96,7 @@ class Redux {
); );
final initialState = await persist.load(); final initialState = await persist.load();
final userStateInitial = UserState.initial(initialState?.userState); final userStateInitial = UserState.initial(initialState!.userState!);
final navStateInitial = NavState.initial(); final navStateInitial = NavState.initial();
final sellStateInitial = SellState.initial(); final sellStateInitial = SellState.initial();

View File

@ -14,13 +14,13 @@ class ApiService extends BaseService {
var client = new http.Client(); var client = new http.Client();
//TOKEN //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>{ Map<String, String> headers = <String, String>{
HttpHeaders.contentTypeHeader: "application/json", HttpHeaders.contentTypeHeader: "application/json",
HttpHeaders.cacheControlHeader: "no-cache" HttpHeaders.cacheControlHeader: "no-cache"
@ -33,7 +33,7 @@ class ApiService extends BaseService {
return response.body; return response.body;
} }
Future<String> _post(String point, {Map<String, dynamic> requestBody, Map<String, String> header}) async { Future<String> _post(String point, {Map<String, dynamic>? requestBody, Map<String, String>? header}) async {
Map<String, String> headers = <String, String>{ Map<String, String> headers = <String, String>{
HttpHeaders.contentTypeHeader: "application/json", HttpHeaders.contentTypeHeader: "application/json",
HttpHeaders.cacheControlHeader: "no-cache" HttpHeaders.cacheControlHeader: "no-cache"
@ -55,7 +55,7 @@ class ApiService extends BaseService {
AuthResponse result; AuthResponse result;
try { try {
String response = await _post('/login', requestBody: requestBody); String response = await _post('/login', requestBody: requestBody);
result = AuthResponse.fromMap(json.decode(response)); result = AuthResponse.fromMap(json.decode(response))!;
} catch (e, stack) { } catch (e, stack) {
log.e("login", e, stack); log.e("login", e, stack);
result = new AuthResponse() result = new AuthResponse()
@ -70,7 +70,7 @@ class ApiService extends BaseService {
AuthResponse result; AuthResponse result;
try { try {
String response = await _post('/authorization', requestBody: requestBody); String response = await _post('/authorization', requestBody: requestBody);
result = AuthResponse.fromMap(json.decode(response)); result = AuthResponse.fromMap(json.decode(response))!;
} catch (e, stack) { } catch (e, stack) {
log.e("authorization", e, stack); log.e("authorization", e, stack);
result = new AuthResponse() result = new AuthResponse()
@ -85,7 +85,7 @@ class ApiService extends BaseService {
AuthResponse result; AuthResponse result;
try { try {
String response = await _post('/auth', header: headers); String response = await _post('/auth', header: headers);
result = AuthResponse.fromMap(json.decode(response)); result = AuthResponse.fromMap(json.decode(response))!;
} catch (e, stack) { } catch (e, stack) {
log.e("auth", e, stack); log.e("auth", e, stack);
result = new AuthResponse() result = new AuthResponse()
@ -100,7 +100,7 @@ class ApiService extends BaseService {
AuthResponse result; AuthResponse result;
try { try {
String response = await _post('/logout', header: headers); String response = await _post('/logout', header: headers);
result = AuthResponse.fromMap(json.decode(response)); result = AuthResponse.fromMap(json.decode(response))!;
} catch (e, stack) { } catch (e, stack) {
log.e("auth", e, stack); log.e("auth", e, stack);
result = new AuthResponse() result = new AuthResponse()

View File

@ -18,9 +18,9 @@ class DbService extends BaseService {
static final DbService instance = DbService._privateConstructor(); static final DbService instance = DbService._privateConstructor();
// only have a single app-wide reference to the database // only have a single app-wide reference to the database
static Database _database; static Database? _database;
Future<Database> get database async { Future<Database?> get database async {
if (_database != null) return _database; if (_database != null) return _database;
// lazily instantiate the db the first time it is accessed // lazily instantiate the db the first time it is accessed
_database = await _initDatabase(); _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 // and the value is the column value. The return value is the id of the
// inserted row. // inserted row.
Future<int> insert(String table, Map<String, dynamic> row) async { Future<int> insert(String table, Map<String, dynamic> row) async {
Database db = await instance.database; Database? db = await instance.database;
return await db.insert(table, row); return await db!.insert(table, row);
} }
// All of the rows are returned as a list of maps, where each map is // All of the rows are returned as a list of maps, where each map is
// a key-value list of columns. // a key-value list of columns.
Future<List<Map<String, dynamic>>> queryAllRows(String table) async { Future<List<Map<String, dynamic>>> queryAllRows(String table) async {
Database db = await instance.database; Database? db = await instance.database;
return await db.query(table); return await db!.query(table);
} }
Future<List<Map<String, dynamic>>> queryRaw(String sql, List<dynamic> args) async { Future<List<Map<String, dynamic>>> queryRaw(String sql, List<dynamic> args) async {
Database db = await instance.database; Database? db = await instance.database;
return await db.rawQuery(sql, args ); return await db!.rawQuery(sql, args );
} }
Future<List<Map<String, dynamic>>> queryAllRowsOrderBy(String table, String orderBy) async { Future<List<Map<String, dynamic>>> queryAllRowsOrderBy(String table, String orderBy) async {
Database db = await instance.database; Database? db = await instance.database;
return await db.query(table, orderBy: orderBy); return await db!.query(table, orderBy: orderBy);
} }
Future<List<Map<String, dynamic>>> queryRowsWithWhere( Future<List<Map<String, dynamic>>> queryRowsWithWhere(
String table, String where, List<dynamic> args, { String orderBy }) async { String table, String where, List<dynamic> args, { String? orderBy }) async {
Database db = await instance.database; Database? db = await instance.database;
return await db.query(table, where: where, whereArgs: args, orderBy: orderBy); return await db!.query(table, where: where, whereArgs: args, orderBy: orderBy);
} }
// All of the methods (insert, query, update, delete) can also be done using // All of the methods (insert, query, update, delete) can also be done using
// raw SQL commands. This method uses a raw query to give the row count. // raw SQL commands. This method uses a raw query to give the row count.
Future<int> queryRowCount(String table) async { Future<int?> queryRowCount(String table) async {
Database db = await instance.database; Database? db = await instance.database;
return Sqflite.firstIntValue( 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 // We are assuming here that the id column in the map is set. The other
// column values will be used to update the row. // column values will be used to update the row.
Future<int> update(String table, Map<String, dynamic> row) async { Future<int> update(String table, Map<String, dynamic> row) async {
Database db = await instance.database; Database? db = await instance.database;
int id = row['id']; 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 // Deletes the row specified by the id. The number of affected rows is
// returned. This should be 1 as long as the row exists. // returned. This should be 1 as long as the row exists.
Future<int> delete(String table, int id) async { Future<int> delete(String table, int id) async {
Database db = await instance.database; Database? db = await instance.database;
return await db.delete(table, where: 'id = ?', whereArgs: [id]); return await db!.delete(table, where: 'id = ?', whereArgs: [id]);
} }
Future<int> deleteAll(String table) async { Future<int> deleteAll(String table) async {
Database db = await instance.database; Database? db = await instance.database;
return await db.delete(table); return await db!.delete(table);
} }
Future<int> deleteByWhere(String table, String where, List<dynamic> args) async { Future<int> deleteByWhere(String table, String where, List<dynamic> args) async {
Database db = await instance.database; Database? db = await instance.database;
return await db.delete(table, where: where, whereArgs: args); return await db!.delete(table, where: where, whereArgs: args);
} }
Future close() async => instance.close(); Future close() async => instance.close();

View File

@ -5,11 +5,11 @@ import 'package:satu/core/models/dialog_models.dart';
class DialogService { class DialogService {
GlobalKey<NavigatorState> _dialogNavigationKey = GlobalKey<NavigatorState>(); GlobalKey<NavigatorState> _dialogNavigationKey = GlobalKey<NavigatorState>();
Function(DialogRequest) _showDialogListener; Function(DialogRequest)? _showDialogListener;
Function(DialogRequest) _showDialogInputListener; Function(DialogRequest)? _showDialogInputListener;
Completer<DialogResponse> _dialogCompleter; Completer<DialogResponse>? _dialogCompleter;
Completer<DialogResponse> get completer => this._dialogCompleter; Completer<DialogResponse>? get completer => this._dialogCompleter;
GlobalKey<NavigatorState> get dialogNavigationKey => _dialogNavigationKey; GlobalKey<NavigatorState> get dialogNavigationKey => _dialogNavigationKey;
@ -23,53 +23,53 @@ class DialogService {
/// Calls the dialog listener and returns a Future that will wait for dialogComplete. /// Calls the dialog listener and returns a Future that will wait for dialogComplete.
Future<DialogResponse> showDialog({ Future<DialogResponse> showDialog({
String title = 'Aman Касса', String title = 'Aman Касса',
String description, String? description,
String buttonTitle = 'Ok', String buttonTitle = 'Ok',
}) { }) {
_dialogCompleter = Completer<DialogResponse>(); _dialogCompleter = Completer<DialogResponse>();
_showDialogListener(DialogRequest( _showDialogListener!(DialogRequest(
title: title, title: title,
description: description, description: description,
buttonTitle: buttonTitle, buttonTitle: buttonTitle,
)); ));
return _dialogCompleter.future; return _dialogCompleter!.future;
} }
/// Shows a confirmation dialog /// Shows a confirmation dialog
Future<DialogResponse> showConfirmationDialog( Future<DialogResponse> showConfirmationDialog(
{String title, {String? title,
String description, String? description,
String confirmationTitle = 'Ok', String confirmationTitle = 'Ok',
String cancelTitle = 'Cancel'}) { String cancelTitle = 'Cancel'}) {
_dialogCompleter = Completer<DialogResponse>(); _dialogCompleter = Completer<DialogResponse>();
_showDialogListener(DialogRequest( _showDialogListener!(DialogRequest(
title: title, title: title,
description: description, description: description,
buttonTitle: confirmationTitle, buttonTitle: confirmationTitle,
cancelTitle: cancelTitle)); cancelTitle: cancelTitle));
return _dialogCompleter.future; return _dialogCompleter!.future;
} }
Future<DialogResponse> showConfirmationDialogInput( Future<DialogResponse> showConfirmationDialogInput(
{String title = ' Aman Касса', {String title = ' Aman Касса',
String description, String? description,
String confirmationTitle = 'Ok', String confirmationTitle = 'Ok',
String cancelTitle = 'Cancel', String cancelTitle = 'Cancel',
String formatType}) { String? formatType}) {
_dialogCompleter = Completer<DialogResponse>(); _dialogCompleter = Completer<DialogResponse>();
_showDialogInputListener(DialogRequest( _showDialogInputListener!(DialogRequest(
title: title, title: title,
description: description, description: description,
buttonTitle: confirmationTitle, buttonTitle: confirmationTitle,
cancelTitle: cancelTitle, cancelTitle: cancelTitle,
formatType: formatType)); formatType: formatType));
return _dialogCompleter.future; return _dialogCompleter!.future;
} }
/// Completes the _dialogCompleter to resume the Future's execution call /// Completes the _dialogCompleter to resume the Future's execution call
void dialogComplete(DialogResponse response) { void dialogComplete(DialogResponse response) {
_dialogNavigationKey.currentState.pop(); _dialogNavigationKey.currentState!.pop();
_dialogCompleter.complete(response); _dialogCompleter!.complete(response);
_dialogCompleter = null; _dialogCompleter = null;
} }
} }

View File

@ -24,11 +24,11 @@ class DictionaryService extends BaseService {
Future<void> refreshCategory() async { Future<void> refreshCategory() async {
try { try {
int appCompanyId = Redux.store.state.userState.auth.companyId; int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
Response categories = await _api.dictionaries('/categories'); Response categories = await _api.dictionaries('/categories');
if (categories.operation && categories.list.isNotEmpty) { if (categories.operation! && categories.list!.isNotEmpty) {
for (dynamic map in categories.list) { for (dynamic map in categories.list!) {
CategoryResponse cat = CategoryResponse.fromMap(map); CategoryResponse cat = CategoryResponse.fromMap(map)!;
Category entity = new Category() Category entity = new Category()
..id = cat.id ..id = cat.id
..name = cat.name ..name = cat.name
@ -46,7 +46,7 @@ class DictionaryService extends BaseService {
Future<List<Category>> getCategoryByParentId(int parentId ) async { Future<List<Category>> getCategoryByParentId(int parentId ) async {
List<Category> list = []; List<Category> list = [];
try { 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]); List<Map<String, dynamic>> elements = await _db.queryRowsWithWhere(CategoryTableName, '$CategoryColumnAppCompanyId = ? and $CategoryColumnParentIn = ?', [appCompanyId, parentId]);
elements.forEach((element) { elements.forEach((element) {
list.add(Category.fromMap(element)); list.add(Category.fromMap(element));
@ -60,7 +60,7 @@ class DictionaryService extends BaseService {
Future<List<Good>> getGoodsByCategoryId(int categoryId ) async { Future<List<Good>> getGoodsByCategoryId(int categoryId ) async {
List<Good> list = []; List<Good> list = [];
try { 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]); List<Map<String, dynamic>> elements = await _db.queryRowsWithWhere(GoodTableName, '$GoodColumnAppCompanyId = ? and $GoodColumnCategoryId = ?', [appCompanyId, categoryId]);
elements.forEach((element) { elements.forEach((element) {
list.add(Good.fromMap(element)); list.add(Good.fromMap(element));
@ -74,7 +74,7 @@ class DictionaryService extends BaseService {
Future<List<Good>> getGoodsByNameOrEan( String query ) async { Future<List<Good>> getGoodsByNameOrEan( String query ) async {
List<Good> list = []; List<Good> list = [];
try { try {
int appCompanyId = Redux.store.state.userState.auth.companyId; int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
String where = '( $GoodColumnAppCompanyId = ? and $GoodColumnName like ? ) '; String where = '( $GoodColumnAppCompanyId = ? and $GoodColumnName like ? ) ';
List args = [appCompanyId, '%$query%']; List args = [appCompanyId, '%$query%'];
if(_isNumericInt(query)){ if(_isNumericInt(query)){
@ -100,11 +100,11 @@ class DictionaryService extends BaseService {
Future<void> refreshGood() async { Future<void> refreshGood() async {
try { try {
int appCompanyId = Redux.store.state.userState.auth.companyId; int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
Response categories = await _api.dictionaries('/goods'); Response categories = await _api.dictionaries('/goods');
if (categories.operation && categories.list.isNotEmpty) { if (categories.operation! && categories.list!.isNotEmpty) {
for (dynamic map in categories.list) { for (dynamic map in categories.list!) {
GoodResponse good = GoodResponse.fromMap(map); GoodResponse good = GoodResponse.fromMap(map)!;
Good entity = new Good() Good entity = new Good()
..id = good.id ..id = good.id
..name = good.name ..name = good.name

View File

@ -8,27 +8,27 @@ class NavigatorService extends BaseService {
Future<dynamic> push(String routeName, {dynamic arguments}) { Future<dynamic> push(String routeName, {dynamic arguments}) {
log.d('routeName: $routeName'); log.d('routeName: $routeName');
return navigatorKey.currentState return navigatorKey.currentState!
.pushNamed(routeName, arguments: arguments); .pushNamed(routeName, arguments: arguments);
} }
Future<dynamic> replace(String routeName, {dynamic arguments}) { Future<dynamic> replace(String routeName, {dynamic arguments}) {
log.d('routeName: $routeName'); log.d('routeName: $routeName');
return navigatorKey.currentState return navigatorKey.currentState!
.pushNamedAndRemoveUntil(routeName, (Route<dynamic> route) => false, arguments: arguments); .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}'); log.d('navigateToPage: pageRoute: ${pageRoute.settings.name}');
if (navigatorKey.currentState == null) { if (navigatorKey.currentState == null) {
log.e('navigateToPage: Navigator State is null'); log.e('navigateToPage: Navigator State is null');
return 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 { MaterialPageRoute<T> pageRoute) async {
log.d('navigateToPageWithReplacement: ' log.d('navigateToPageWithReplacement: '
'pageRoute: ${pageRoute.settings.name}'); 'pageRoute: ${pageRoute.settings.name}');
@ -36,15 +36,15 @@ class NavigatorService extends BaseService {
log.e('navigateToPageWithReplacement: Navigator State is null'); log.e('navigateToPageWithReplacement: Navigator State is null');
return 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:'); log.d('goBack:');
if (navigatorKey.currentState == null) { if (navigatorKey.currentState == null) {
log.e('goBack: Navigator State is null'); log.e('goBack: Navigator State is null');
return; return;
} }
navigatorKey.currentState.pop(result); navigatorKey.currentState!.pop(result);
} }
} }

View File

@ -14,13 +14,13 @@ class SimpleLogPrinter extends LogPrinter {
var error = event.error?.toString() ?? ''; var error = event.error?.toString() ?? '';
var color = PrettyPrinter.levelColors[level]; var color = PrettyPrinter.levelColors[level];
var emoji = PrettyPrinter.levelEmojis[level]; var emoji = PrettyPrinter.levelEmojis[level];
String stack; String? stack;
if (event.stackTrace == null) { if (event.stackTrace == null) {
stack = formatStackTrace(StackTrace.current, 2); stack = formatStackTrace(StackTrace.current, 2);
} else { } else {
stack = formatStackTrace(event.stackTrace, 1); stack = formatStackTrace(event.stackTrace!, 1);
} }
print(color(' $emoji $message $error -> $stack ')); print(color!(' $emoji $message $error -> $stack '));
return []; return [];
} }
@ -33,8 +33,8 @@ class SimpleLogPrinter extends LogPrinter {
} }
} }
String formatStackTrace(StackTrace stackTrace, int methodPosition) { String? formatStackTrace(StackTrace stackTrace, int methodPosition) {
var lines = stackTrace.toString()?.split('\n'); var lines = stackTrace.toString().split('\n');
var formatted = <String>[]; var formatted = <String>[];
var count = 0; var count = 0;
for (var line in lines) { for (var line in lines) {
@ -61,7 +61,7 @@ class SimpleLogPrinter extends LogPrinter {
if (match == null) { if (match == null) {
return false; return false;
} }
return match.group(2).startsWith('package:logger'); return match.group(2)!.startsWith('package:logger');
} }
bool _discardWebStacktraceLine(String line) { bool _discardWebStacktraceLine(String line) {
@ -69,8 +69,8 @@ class SimpleLogPrinter extends LogPrinter {
if (match == null) { if (match == null) {
return false; return false;
} }
return match.group(1).startsWith('packages/logger') || return match.group(1)!.startsWith('packages/logger') ||
match.group(1).startsWith('dart-sdk/lib'); match.group(1)!.startsWith('dart-sdk/lib');
} }
} }

View File

@ -1,4 +1,4 @@
List<String> parseListString(json){ List<String>? parseListString(json){
if(json==null) return null; if(json==null) return null;
return new List<String>.from(json); return new List<String>.from(json);
} }

View File

@ -34,7 +34,7 @@ class MainApplication extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StoreProvider<AppState>( return StoreProvider<AppState>(
store: Redux.store, store: Redux.store!,
child: ScreenUtilInit( child: ScreenUtilInit(
designSize: Size(411.43, 683.43), designSize: Size(411.43, 683.43),
builder: () => MaterialApp( builder: () => MaterialApp(
@ -51,7 +51,7 @@ class MainApplication extends StatelessWidget {
builder: (context, child) => Navigator( builder: (context, child) => Navigator(
key: locator<DialogService>().dialogNavigationKey, key: locator<DialogService>().dialogNavigationKey,
onGenerateRoute: (settings) => MaterialPageRoute( onGenerateRoute: (settings) => MaterialPageRoute(
builder: (context) => DialogManager(child: child)), builder: (context) => DialogManager(child: child!)),
), ),
navigatorKey: locator<NavigatorService>().navigatorKey, navigatorKey: locator<NavigatorService>().navigatorKey,
home: StartUpView(), // first page home: StartUpView(), // first page

View File

@ -14,32 +14,32 @@ Route<dynamic> generateRoute(RouteSettings settings) {
case LoginViewRoute: case LoginViewRoute:
//LoginModel model = settings.arguments as LoginModel; //LoginModel model = settings.arguments as LoginModel;
return _getPageRoute( return _getPageRoute(
routeName: settings.name, routeName: settings.name!,
viewToShow: LoginView(), viewToShow: LoginView(),
); );
case WorkViewRoute: case WorkViewRoute:
return _getPageRoute( return _getPageRoute(
routeName: settings.name, routeName: settings.name!,
viewToShow: WorkView(), viewToShow: WorkView(),
); );
case MainViewRoute: case MainViewRoute:
return _getPageRoute( return _getPageRoute(
routeName: settings.name, routeName: settings.name!,
viewToShow: MainView(), viewToShow: MainView(),
); );
case AddProductViewRoute: case AddProductViewRoute:
return _getPageRoute( return _getPageRoute(
routeName: settings.name, routeName: settings.name!,
viewToShow: AddProductView(), viewToShow: AddProductView(),
); );
case AddByBarcodeViewRoute: case AddByBarcodeViewRoute:
return _getPageRoute( return _getPageRoute(
routeName: settings.name, routeName: settings.name!,
viewToShow: AddByBarcodeView(title: 'Scanner',), viewToShow: AddByBarcodeView(title: 'Scanner',),
); );
case SettingPrinterBluetoothViewRoute: case SettingPrinterBluetoothViewRoute:
return _getPageRoute( return _getPageRoute(
routeName: settings.name, routeName: settings.name!,
//viewToShow: PrinterSelectView(title: 'Принтер печати чеков',), //viewToShow: PrinterSelectView(title: 'Принтер печати чеков',),
); );
// case ImageShowRoute: // 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( return MaterialPageRoute(
settings: RouteSettings( settings: RouteSettings(
name: routeName, name: routeName,
), ),
builder: (_) => viewToShow); builder: (_) => viewToShow!);
} }
class SlideRightRoute extends PageRouteBuilder { class SlideRightRoute extends PageRouteBuilder {
final Widget widget; final Widget? widget;
SlideRightRoute({this.widget}) SlideRightRoute({this.widget})
: super( : super(
pageBuilder: (BuildContext context, Animation<double> animation, pageBuilder: (BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) { Animation<double> secondaryAnimation) {
return widget; return widget!;
}, },
transitionsBuilder: (BuildContext context, transitionsBuilder: (BuildContext context,
Animation<double> animation, Animation<double> animation,

View File

@ -4,11 +4,11 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class AddByBarcodeView extends StatefulWidget { class AddByBarcodeView extends StatefulWidget {
final String title; final String? title;
final int transactionId; final int? transactionId;
const AddByBarcodeView({ const AddByBarcodeView({
Key key, Key? key,
this.title, this.title,
this.transactionId, this.transactionId,
}) : super(key: key); }) : super(key: key);
@ -30,7 +30,7 @@ class _AddByBarcodeViewState extends State<AddByBarcodeView> {
child: Center( child: Center(
child: Hero( child: Hero(
tag: 'text', tag: 'text',
child: Text(widget.title)), child: Text(widget.title ?? '')),
), ),
); );
} }

View File

@ -22,13 +22,13 @@ class AddProductView extends StatefulWidget {
class _AddProductViewState extends State<AddProductView> { class _AddProductViewState extends State<AddProductView> {
final DictionaryService _dictionaryService = locator<DictionaryService>(); final DictionaryService _dictionaryService = locator<DictionaryService>();
final NavigatorService _navigatorService = locator<NavigatorService>(); final NavigatorService _navigatorService = locator<NavigatorService>();
TextEditingController _searchTextController; late TextEditingController _searchTextController;
final FocusNode _searchFocusNode = new FocusNode(); final FocusNode _searchFocusNode = new FocusNode();
List<Category> _history; List<Category>? _history;
List<Category> _categories; List<Category>? _categories;
List<Good> _goods; List<Good>? _goods;
@override @override
@ -78,7 +78,7 @@ class _AddProductViewState extends State<AddProductView> {
itemCount: catSize + goodSize, itemCount: catSize + goodSize,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
if (index < catSize) { if (index < catSize) {
Category category = _categories[index]; Category category = _categories![index];
return AddCategoryListItem( return AddCategoryListItem(
name: category.name, name: category.name,
isOdd: index % 2 == 0, isOdd: index % 2 == 0,
@ -86,14 +86,14 @@ class _AddProductViewState extends State<AddProductView> {
onPress: () => onCategoryPress(category), onPress: () => onCategoryPress(category),
); );
} }
Good good = _goods[index - catSize]; Good good = _goods![index - catSize];
return AddProductListItem( return AddProductListItem(
key: Key('product_${good.id}'), key: Key('product_${good.id}'),
ean: good.ean, ean: good.ean,
isOdd: index % 2 == 0, isOdd: index % 2 == 0,
name: good.name, name: good.name,
price: good.price, price: good.price,
categoryName: _history.last?.name, categoryName: _history?.last?.name!,
onPress: () => onGoodPress(good), onPress: () => onGoodPress(good),
); );
}, },
@ -107,21 +107,21 @@ class _AddProductViewState extends State<AddProductView> {
} }
onCategoryPress(Category category) { onCategoryPress(Category category) {
_history.add(category); _history!.add(category);
navigateCategory(category.id); navigateCategory(category.id!);
} }
onGoodPress(Good good) { onGoodPress(Good good) {
Redux.store.dispatch(addSellItem(good: good)); Redux.store!.dispatch(addSellItem(good: good));
_navigatorService.pop(); _navigatorService.pop();
} }
List<Widget> actions() { List<Widget> actions() {
return [ return [
if(_history.length > 1) if(_history!.length > 1)
FlatButton(onPressed: () { FlatButton(onPressed: () {
_history.removeLast(); _history!.removeLast();
navigateCategory(_history.last.id); navigateCategory(_history!.last.id!);
}, child: Text('Назад', style: TextStyle(color: Colors.black),),), }, child: Text('Назад', style: TextStyle(color: Colors.black),),),
FlatButton(onPressed: reset, child: Text('Сбросить', style: TextStyle(color: Colors.black),),) FlatButton(onPressed: reset, child: Text('Сбросить', style: TextStyle(color: Colors.black),),)

View File

@ -5,17 +5,17 @@ import 'package:satu/shared/shared_styles.dart';
import 'package:satu/shared/ui_helpers.dart'; import 'package:satu/shared/ui_helpers.dart';
class AddCategoryListItem extends StatelessWidget { class AddCategoryListItem extends StatelessWidget {
final String name; final String? name;
final bool isOdd; final bool? isOdd;
final Function onPress; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Card( return Card(
child: ListTile( child: ListTile(
onTap: onPress, onTap: () => onPress,
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0), contentPadding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
title: Padding( title: Padding(
padding: const EdgeInsets.only(top: 4.0), padding: const EdgeInsets.only(top: 4.0),
@ -23,7 +23,7 @@ class AddCategoryListItem extends StatelessWidget {
height: 50, height: 50,
child: Center( child: Center(
child: Text( child: Text(
name, name!,
style: productTextStyle, style: productTextStyle,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 3, maxLines: 3,
@ -31,7 +31,7 @@ class AddCategoryListItem extends StatelessWidget {
) )
), ),
), ),
tileColor: !isOdd ? fillColor : backgroundColor, tileColor: !isOdd! ? fillColor : backgroundColor,
trailing: Icon( trailing: Icon(
Icons.arrow_right, Icons.arrow_right,
color: yellowColor, color: yellowColor,

View File

@ -5,21 +5,21 @@ import 'package:satu/shared/shared_styles.dart';
import 'package:satu/shared/ui_helpers.dart'; import 'package:satu/shared/ui_helpers.dart';
class AddProductListItem extends StatelessWidget { class AddProductListItem extends StatelessWidget {
final String name; final String? name;
final String ean; final String? ean;
final String categoryName; final String? categoryName;
final num price; final num? price;
final num count; final num? count;
final bool isOdd; final bool? isOdd;
final Function onPress; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Card( return Card(
child: ListTile( child: ListTile(
onTap: onPress, onTap: () => onPress,
contentPadding: const EdgeInsets.symmetric( horizontal: 8.0 ,vertical: 4.0 ), contentPadding: const EdgeInsets.symmetric( horizontal: 8.0 ,vertical: 4.0 ),
title: Padding( title: Padding(
padding: const EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
@ -32,12 +32,12 @@ class AddProductListItem extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(name , style: productTextStyle, overflow: TextOverflow.ellipsis, maxLines: 2,), Text(name! , style: productTextStyle, overflow: TextOverflow.ellipsis, maxLines: 2,),
verticalSpaceTiny, verticalSpaceTiny,
if(ean!=null) if(ean!=null)
Text('Штрих-код: $ean' , style: productSubTextStyle,), Text('Штрих-код: $ean' , style: productSubTextStyle,),
if(categoryName!=null) 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,
), ),
); );
} }

View File

@ -4,14 +4,14 @@ import 'package:satu/core/utils/locator.dart';
import 'package:satu/shared/app_colors.dart'; import 'package:satu/shared/app_colors.dart';
class AddProductAppBar extends StatelessWidget implements PreferredSizeWidget { class AddProductAppBar extends StatelessWidget implements PreferredSizeWidget {
final String title; final String? title;
final List<Widget> actions; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppBar( 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, backgroundColor: Colors.transparent,
elevation: 0.0, elevation: 0.0,
actions: actions actions: actions

View File

@ -1,9 +1,5 @@
import 'dart:ui'; 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/services.dart';
import 'package:flutter_redux/flutter_redux.dart'; import 'package:flutter_redux/flutter_redux.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -26,9 +22,9 @@ class LoginView extends StatefulWidget {
} }
class _LoginViewState extends State<LoginView> { class _LoginViewState extends State<LoginView> {
TextEditingController emailController; late TextEditingController emailController;
TextEditingController passwordController; late TextEditingController passwordController;
final FocusNode passwordNode = new FocusNode(); final FocusNode passwordNode = new FocusNode();
@ -56,7 +52,7 @@ class _LoginViewState extends State<LoginView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StoreConnector<AppState, UserState>( return StoreConnector<AppState, UserState>(
converter: (store) => store.state.userState, converter: (store) => store.state.userState!,
builder: (context, vm) { builder: (context, vm) {
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
@ -110,7 +106,7 @@ class _LoginViewState extends State<LoginView> {
width: 150, width: 150,
child: BusyButton( child: BusyButton(
title: 'Войти', title: 'Войти',
busy: vm.isLoading, busy: vm.isLoading!,
onPressed: _pressBtnEnter, onPressed: _pressBtnEnter,
mainColor: yellowColor, mainColor: yellowColor,
), ),
@ -135,38 +131,38 @@ class _LoginViewState extends State<LoginView> {
} }
_pressBtnEnter() async { _pressBtnEnter() async {
Redux.store.dispatch(authenticate(emailController.text, passwordController.text)); Redux.store!.dispatch(authenticate(emailController.text, passwordController.text));
} }
Future<void> scan() async { Future<void> scan() async {
try { // try {
var options = ScanOptions(strings: { // var options = ScanOptions(strings: {
"cancel": 'Отмена', // "cancel": 'Отмена',
"flash_on": 'Вкл фонарик', // "flash_on": 'Вкл фонарик',
"flash_off": 'Выкл фонарик', // "flash_off": 'Выкл фонарик',
}); // });
var result = await BarcodeScanner.scan(options: options); // var result = await BarcodeScanner.scan(options: options);
print(result.type); // The result type (barcode, cancelled, failed) // print(result.type); // The result type (barcode, cancelled, failed)
print(result.rawContent); // The barcode content // print(result.rawContent); // The barcode content
print(result.format); // The barcode format (as enum) // print(result.format); // The barcode format (as enum)
print(result.formatNote); // If a unknown format was scanned this field contains a note // print(result.formatNote); // If a unknown format was scanned this field contains a note
if (result.type == ResultType.Barcode && result.rawContent?.length == 60) { // if (result.type == ResultType.Barcode && result.rawContent?.length == 60) {
//Redux.store.dispatch(authenticateToken(result.rawContent)); // //Redux.store.dispatch(authenticateToken(result.rawContent));
} else if (result.type == ResultType.Error) { // } else if (result.type == ResultType.Error) {
_dialogService.showDialog(description: 'Не верный формат QR кода'); // _dialogService.showDialog(description: 'Не верный формат QR кода');
} // }
} on PlatformException catch (e) { // } on PlatformException catch (e) {
var result = ScanResult.create(); // var result = ScanResult.create();
result.type = ResultType.Error; // result.type = ResultType.Error;
result.format = BarcodeFormat.unknown; // result.format = BarcodeFormat.unknown;
if (e.code == BarcodeScanner.cameraAccessDenied) { // if (e.code == BarcodeScanner.cameraAccessDenied) {
result.rawContent = 'The user did not grant the camera permission!'; // result.rawContent = 'The user did not grant the camera permission!';
_dialogService.showDialog(description: 'Нет доступа до камеры устройства'); // _dialogService.showDialog(description: 'Нет доступа до камеры устройства');
} else { // } else {
result.rawContent = 'Unknown error: $e'; // result.rawContent = 'Unknown error: $e';
_dialogService.showDialog(description: 'Неизвестная ошибка: $e'); // _dialogService.showDialog(description: 'Неизвестная ошибка: $e');
} // }
} // }
} }
} }
@ -175,5 +171,5 @@ class LoginModel {
final String login; final String login;
final String password; final String password;
LoginModel({this.authType, this.login, this.password}); LoginModel({required this.authType, required this.login, required this.password});
} }

View File

@ -37,9 +37,9 @@ class _MainViewState extends State<MainView> {
key: _navigatorService.scaffoldDrawerKey, key: _navigatorService.scaffoldDrawerKey,
drawer: AppDrawer(), drawer: AppDrawer(),
body: StoreConnector<AppState, NavState>( body: StoreConnector<AppState, NavState>(
converter: (store) => store.state.navState, converter: (store) => store.state.navState!,
builder: (_, vm) { builder: (_, vm) {
return _body(vm.drawerViewClass); return _body(vm.drawerViewClass!);
}) })
); );
} }

View File

@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
class SettingItem extends StatefulWidget { class SettingItem extends StatefulWidget {
final String name; final String? name;
final String value; final String? value;
final Function onTap; 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 @override
_SettingItemState createState() => _SettingItemState(); _SettingItemState createState() => _SettingItemState();
@ -17,10 +17,10 @@ class _SettingItemState extends State<SettingItem> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Card( return Card(
child: ListTile( child: ListTile(
title: Text(widget.name), title: Text(widget.name ?? ''),
subtitle: widget.value !=null ? Text(widget.value) : null, subtitle: widget.value !=null ? Text(widget.value ?? '') : null,
trailing: Icon(Icons.chevron_right), trailing: Icon(Icons.chevron_right),
onTap: widget.onTap, onTap: () => widget.onTap,
), ),
); );
} }

View File

@ -30,7 +30,7 @@ class _StartUpViewState extends State<StartUpView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StoreConnector<AppState, UserState>( return StoreConnector<AppState, UserState>(
converter: (store) => store.state.userState, converter: (store) => store.state.userState!,
builder: (context, userState) { builder: (context, userState) {
return Scaffold( return Scaffold(
body: Center( body: Center(
@ -56,6 +56,6 @@ class _StartUpViewState extends State<StartUpView> {
void redirect() async { void redirect() async {
await Future.delayed(Duration(milliseconds: 100)); await Future.delayed(Duration(milliseconds: 100));
Redux.store.dispatch(auth); Redux.store!.dispatch(auth);
} }
} }

View File

@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
class CustomField extends StatelessWidget { class CustomField extends StatelessWidget {
final String hintText; final String? hintText;
final IconData iconData; final IconData? iconData;
final String label; final String? label;
CustomField({@required this.hintText, @required this.iconData, this.label}); CustomField({@required this.hintText, @required this.iconData, this.label});

View File

@ -6,7 +6,7 @@ class OptionPill extends StatelessWidget {
final String text; final String text;
final bool selected; final bool selected;
OptionPill({@required this.text, @required this.selected}); OptionPill({required this.text, required this.selected});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

@ -11,16 +11,16 @@ import 'package:satu/shared/ui_helpers.dart';
import 'package:satu/views/add_by_barcode/add_by_barcode_view.dart'; import 'package:satu/views/add_by_barcode/add_by_barcode_view.dart';
class ProductListItem extends StatefulWidget { class ProductListItem extends StatefulWidget {
final String name; final String? name;
final String ean; final String? ean;
final String categoryName; final String? categoryName;
final num price; final num? price;
final num count; final num? count;
final bool isOdd; final bool? isOdd;
final int transactionId; final int? transactionId;
const ProductListItem( 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); : super(key: key);
@override @override
@ -73,9 +73,9 @@ class _ProductListItemState extends State<ProductListItem> {
}, },
onDismissed: (direction) { onDismissed: (direction) {
print(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( child: ListTile(
onTap: () => _onItemTapped(context), onTap: () => _onItemTapped(context),
contentPadding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0), contentPadding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0),
@ -91,7 +91,7 @@ class _ProductListItemState extends State<ProductListItem> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
widget.name, widget.name ?? '',
style: const TextStyle(fontWeight: FontWeight.w500), style: const TextStyle(fontWeight: FontWeight.w500),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 2, maxLines: 2,
@ -127,7 +127,7 @@ class _ProductListItemState extends State<ProductListItem> {
], ],
), ),
), ),
tileColor: !widget.isOdd ? fillColor : backgroundColor, tileColor: !widget.isOdd! ? fillColor : backgroundColor,
), ),
); );
} }

View File

@ -5,14 +5,14 @@ import 'package:satu/shared/app_colors.dart';
import 'package:satu/views/work/tabs/component/products_header_bar.dart'; import 'package:satu/views/work/tabs/component/products_header_bar.dart';
class ProductsAppBar extends StatelessWidget implements PreferredSizeWidget { class ProductsAppBar extends StatelessWidget implements PreferredSizeWidget {
final String title; final String? title;
final List<Widget> actions; final List<Widget>? actions;
final Widget child; final Widget? child;
final int childHeight; final int? childHeight;
final num elevation; final double elevation;
final Color backgroundColor; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Material( return Material(
@ -21,20 +21,20 @@ class ProductsAppBar extends StatelessWidget implements PreferredSizeWidget {
child: Column( child: Column(
children: [ children: [
AppBar( AppBar(
title: Text(title), title: Text(title ?? ''),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
elevation: 0.0, elevation: 0.0,
leading: IconButton( leading: IconButton(
icon: Icon(Icons.menu, color: yellowColor,), icon: Icon(Icons.menu, color: yellowColor,),
onPressed: () { onPressed: () {
locator<NavigatorService>().scaffoldDrawerKey.currentState.openDrawer(); locator<NavigatorService>().scaffoldDrawerKey.currentState!.openDrawer();
}, },
), ),
actions: actions actions: actions
, ,
), ),
if(child !=null && childHeight > 0) if(child !=null && childHeight! > 0)
child, child!,
], ],
), ),
); );
@ -42,6 +42,6 @@ class ProductsAppBar extends StatelessWidget implements PreferredSizeWidget {
@override @override
Size get preferredSize { Size get preferredSize {
return new Size.fromHeight(60.0 + childHeight); return new Size.fromHeight(60.0 + childHeight!);
} }
} }

View File

@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
import 'package:satu/shared/app_colors.dart'; import 'package:satu/shared/app_colors.dart';
import 'package:satu/shared/shared_styles.dart'; import 'package:satu/shared/shared_styles.dart';
import 'package:satu/widgets/dialog/modal_select_dialog.dart'; import 'package:satu/widgets/dialog/modal_select_dialog.dart';
import 'package:searchable_dropdown/searchable_dropdown.dart';
class ProductHeaderBar extends StatelessWidget { class ProductHeaderBar extends StatelessWidget {
final int count; final int count;
final num sum; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -37,20 +37,21 @@ class ProductHeaderBar extends StatelessWidget {
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return DropdownDialog( return Container();
dialogBox: true, // return DropdownDialog(
multipleSelection: false, // dialogBox: true,
items: <String>['Частное лицо', 'ИП Иванов', 'ТО "Рога и копыта"', 'Network Energy'] // multipleSelection: false,
.map<DropdownMenuItem<String>>((String value) { // items: <String>['Частное лицо', 'ИП Иванов', 'ТО "Рога и копыта"', 'Network Energy']
return DropdownMenuItem<String>( // .map<DropdownMenuItem<String>>((String value) {
value: value, // return DropdownMenuItem<String>(
child: Text(value), // value: value,
); // child: Text(value),
}).toList(), // );
selectedItems: selected, // }).toList(),
hint: Text('Выберите контрагента'), // selectedItems: selected,
closeButton: 'Отмена', // hint: Text('Выберите контрагента'),
); // closeButton: 'Отмена',
// );
}).then((value) => { }).then((value) => {
print(selected) print(selected)
}); });

View File

@ -7,7 +7,7 @@ class TransactionItem extends StatelessWidget {
final String amount; final String amount;
final bool received; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

View File

@ -22,7 +22,7 @@ class SellView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StoreConnector<AppState, SellState>( return StoreConnector<AppState, SellState>(
converter: (store) => store.state.sellState, converter: (store) => store.state.sellState!,
builder: (_, state) { builder: (_, state) {
return Scaffold( return Scaffold(
appBar: ProductsAppBar( appBar: ProductsAppBar(
@ -30,17 +30,17 @@ class SellView extends StatelessWidget {
actions: actions(), actions: actions(),
elevation: 2.0, elevation: 2.0,
child: ProductHeaderBar( child: ProductHeaderBar(
count: state.items.length, count: state.items!.length,
sum: sumProducts(state.items), sum: sumProducts(state.items!),
), ),
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
childHeight: 80, childHeight: 80,
), ),
body: ListView.builder( body: ListView.builder(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemCount: state.items.length, itemCount: state.items!.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
ProductDao product = state.items.elementAt(index); ProductDao product = state.items!.elementAt(index);
return ProductListItem( return ProductListItem(
key: UniqueKey(), key: UniqueKey(),
ean: product.eanCode, ean: product.eanCode,
@ -61,7 +61,7 @@ class SellView extends StatelessWidget {
Widget floatingActionButtonRender() { Widget floatingActionButtonRender() {
return StoreConnector<AppState, SellState>( return StoreConnector<AppState, SellState>(
converter: (store) => store.state.sellState, converter: (store) => store.state.sellState!,
builder: (_, snapshot) { builder: (_, snapshot) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 16.0), padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 16.0),
@ -70,7 +70,7 @@ class SellView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[ children: <Widget>[
Visibility( Visibility(
visible: snapshot.items.isNotEmpty, visible: snapshot.items!.isNotEmpty,
child: FloatingActionButton( child: FloatingActionButton(
elevation: 2, elevation: 2,
backgroundColor: greenColor, backgroundColor: greenColor,
@ -111,7 +111,7 @@ class SellView extends StatelessWidget {
child: IconButton( child: IconButton(
icon: Icon(Icons.delete, size: 30.0, color: yellowColor), icon: Icon(Icons.delete, size: 30.0, color: yellowColor),
onPressed: () { onPressed: () {
Redux.store.dispatch(removeAllSellData); Redux.store!.dispatch(removeAllSellData);
}), }),
) )
]; ];

View File

@ -4,7 +4,7 @@ num sumProducts(List<ProductDao> list) {
num result = 0.0; num result = 0.0;
if (list.isNotEmpty) { if (list.isNotEmpty) {
list.forEach((product) { list.forEach((product) {
result += (product.price * product.count); result += (product.price! * product.count!);
}); });
} }

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.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/actions/sell_actions.dart';
import 'package:satu/core/redux/store.dart'; import 'package:satu/core/redux/store.dart';
import 'package:satu/shared/app_colors.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'; import 'package:satu/views/work/tabs/sell_view.dart';
class WorkView extends StatefulWidget { 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 @override
_WorkViewState createState() => _WorkViewState(); _WorkViewState createState() => _WorkViewState();
} }
@ -30,7 +31,7 @@ class _WorkViewState extends State<WorkView> {
void initState() { void initState() {
super.initState(); super.initState();
// state sell view // state sell view
Redux.store.dispatch(loadSellData); Redux.store!.dispatch(loadSellData);
} }
void _onItemTapped(int index) { void _onItemTapped(int index) {

View File

@ -8,17 +8,17 @@ class AmanIconButton extends StatefulWidget {
final bool busy; final bool busy;
final String title; final String title;
final Function onPressed; final Function onPressed;
final bool enabled; final bool? enabled;
final Color mainColor; final Color mainColor;
final IconData icon; final IconData icon;
const AmanIconButton( const AmanIconButton(
{ {
@required this.title, required this.title,
this.busy = false, this.busy = false,
@required this.onPressed, required this.onPressed,
this.enabled = true, this.enabled = true,
this.mainColor, required this.mainColor,
@required this.icon required this.icon
}); });
@override @override
@ -31,7 +31,11 @@ class _AmanIconButtonState extends State<AmanIconButton> {
return GestureDetector( return GestureDetector(
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
onTap: widget.busy ? () {} : widget.onPressed, onTap: () {
if(!widget.busy) {
widget.onPressed();
}
},
child: Container( child: Container(
//height: 75, //height: 75,
width: 120, width: 120,

View File

@ -9,12 +9,12 @@ class BusyButton extends StatefulWidget {
final String title; final String title;
final Function onPressed; final Function onPressed;
final bool enabled; final bool enabled;
final Color mainColor; final Color? mainColor;
const BusyButton({ const BusyButton({
@required this.title, required this.title,
this.busy = false, this.busy = false,
@required this.onPressed, required this.onPressed,
this.enabled = true, this.enabled = true,
this.mainColor, this.mainColor,
}); });
@ -38,7 +38,10 @@ class _BusyButtonState extends State<BusyButton> {
child: Material( child: Material(
type: MaterialType.transparency, type: MaterialType.transparency,
child: InkWell( child: InkWell(
onTap: widget.busy || !widget.enabled ? null : widget.onPressed, onTap: () {
if(!(widget.busy || !widget.enabled))
widget.onPressed();
},
child: AnimatedContainer( child: AnimatedContainer(
height: widget.busy ? 45 : 45, height: widget.busy ? 45 : 45,
//width: widget.busy ? 40 : 40, //width: widget.busy ? 40 : 40,

View File

@ -8,14 +8,14 @@ import 'package:satu/core/utils/locator.dart';
class DialogManager extends StatefulWidget { class DialogManager extends StatefulWidget {
final Widget child; final Widget child;
DialogManager({Key key, this.child}) : super(key: key); DialogManager({Key? key, required this.child}) : super(key: key);
_DialogManagerState createState() => _DialogManagerState(); _DialogManagerState createState() => _DialogManagerState();
} }
class _DialogManagerState extends State<DialogManager> { class _DialogManagerState extends State<DialogManager> {
final DialogService _dialogService = locator<DialogService>(); final DialogService _dialogService = locator<DialogService>();
TextEditingController _controller; late TextEditingController _controller;
@override @override
void initState() { void initState() {
@ -48,24 +48,24 @@ class _DialogManagerState extends State<DialogManager> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text( Text(
request.title, request.title!,
style: TextStyle(fontWeight: FontWeight.bold), style: TextStyle(fontWeight: FontWeight.bold),
), ),
//Divider(), //Divider(),
], ],
), ),
content: Text(request.description), content: Text(request.description!),
actions: <Widget>[ actions: <Widget>[
if (isConfirmationDialog) if (isConfirmationDialog)
FlatButton( FlatButton(
child: Text(request.cancelTitle), child: Text(request.cancelTitle!),
onPressed: () { onPressed: () {
_dialogService _dialogService
.dialogComplete(DialogResponse(confirmed: false)); .dialogComplete(DialogResponse(confirmed: false));
}, },
), ),
FlatButton( FlatButton(
child: Text(request.buttonTitle), child: Text(request.buttonTitle!),
onPressed: () { onPressed: () {
_dialogService _dialogService
.dialogComplete(DialogResponse(confirmed: true)); .dialogComplete(DialogResponse(confirmed: true));
@ -95,7 +95,7 @@ class _DialogManagerState extends State<DialogManager> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text( Text(
request.title, request.title!,
style: TextStyle(fontWeight: FontWeight.bold), style: TextStyle(fontWeight: FontWeight.bold),
), ),
//Divider(), //Divider(),
@ -131,7 +131,7 @@ class _DialogManagerState extends State<DialogManager> {
RaisedButton( RaisedButton(
//color: redColor, //color: redColor,
child: Text( child: Text(
request.cancelTitle, request.cancelTitle!,
style: TextStyle(fontSize: 18), style: TextStyle(fontSize: 18),
), ),
onPressed: () { onPressed: () {
@ -145,7 +145,7 @@ class _DialogManagerState extends State<DialogManager> {
RaisedButton( RaisedButton(
//color: primaryColor, //color: primaryColor,
child: Text( child: Text(
request.buttonTitle, request.buttonTitle!,
style: TextStyle(fontSize: 18), style: TextStyle(fontSize: 18),
), ),
onPressed: () { onPressed: () {
@ -162,7 +162,7 @@ class _DialogManagerState extends State<DialogManager> {
dialogController.whenComplete(() { dialogController.whenComplete(() {
//hook when press overlay and response not completed //hook when press overlay and response not completed
if (_dialogService.completer != null) { if (_dialogService.completer != null) {
_dialogService.completer.complete(DialogResponse(confirmed: false)); _dialogService.completer!.complete(DialogResponse(confirmed: false));
} }
}); });
} }

View File

@ -1,11 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class DialogModalSelect extends StatefulWidget { class DialogModalSelect extends StatefulWidget {
final String title; final String? title;
final String descriptions; final String? descriptions;
final String text; 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); : super(key: key);
@override @override
@ -50,14 +50,14 @@ class _DialogModalSelectState extends State<DialogModalSelect> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Text( Text(
widget.title, widget.title ?? '',
style: TextStyle(fontSize: 22, fontWeight: FontWeight.w600), style: TextStyle(fontSize: 22, fontWeight: FontWeight.w600),
), ),
SizedBox( SizedBox(
height: 15, height: 15,
), ),
Text( Text(
widget.descriptions, widget.descriptions ?? '',
style: TextStyle(fontSize: 14), style: TextStyle(fontSize: 14),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -71,7 +71,7 @@ class _DialogModalSelectState extends State<DialogModalSelect> {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: Text( child: Text(
widget.text, widget.text ?? '',
style: TextStyle(fontSize: 18), style: TextStyle(fontSize: 18),
)), )),
), ),

View File

@ -3,8 +3,7 @@ import 'package:flutter/material.dart';
import 'package:satu/core/redux/actions/nav_actions.dart'; import 'package:satu/core/redux/actions/nav_actions.dart';
import 'package:satu/core/redux/actions/user_actions.dart'; import 'package:satu/core/redux/actions/user_actions.dart';
import 'package:satu/core/redux/store.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/app_colors.dart';
import 'package:satu/shared/ui_helpers.dart'; import 'package:satu/shared/ui_helpers.dart';
import 'package:satu/views/settings/setting_view.dart'; import 'package:satu/views/settings/setting_view.dart';
@ -20,7 +19,7 @@ class AppDrawer extends StatelessWidget {
_createHeader(), _createHeader(),
_createDrawerItem(icon: Icons.contacts, text: 'Касса', onTap: () { _createDrawerItem(icon: Icons.contacts, text: 'Касса', onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
Redux.store.dispatch(navigateDrawer(WorkView)); Redux.store!.dispatch(navigateDrawer(WorkView));
}), }),
Divider(), Divider(),
ExpansionTile( ExpansionTile(
@ -49,13 +48,13 @@ class AppDrawer extends StatelessWidget {
), ),
_createDrawerItem(icon: Icons.settings, text: 'Настройки', onTap: () { _createDrawerItem(icon: Icons.settings, text: 'Настройки', onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
Redux.store.dispatch(navigateDrawer(SettingsView)); Redux.store!.dispatch(navigateDrawer(SettingsView));
}), }),
Divider(), Divider(),
_createDrawerItem(icon: Icons.bug_report, text: 'Сообщить об ошибке'), _createDrawerItem(icon: Icons.bug_report, text: 'Сообщить об ошибке'),
verticalSpaceMedium, verticalSpaceMedium,
_createDrawerItem(icon: Icons.exit_to_app, text: 'Выйти из аккаунта', onTap: () async { _createDrawerItem(icon: Icons.exit_to_app, text: 'Выйти из аккаунта', onTap: () async {
Redux.store.dispatch(logout); Redux.store!.dispatch(logout);
}), }),
ListTile( ListTile(
title: Text('0.0.1'), title: Text('0.0.1'),
@ -91,7 +90,7 @@ class AppDrawer extends StatelessWidget {
} }
Widget _createDrawerItem( Widget _createDrawerItem(
{IconData icon, String text, GestureTapCallback onTap}) { {required IconData icon, required String text, GestureTapCallback? onTap}) {
return ListTile( return ListTile(
title: Row( title: Row(
children: <Widget>[ children: <Widget>[

View File

@ -3,25 +3,25 @@ import 'package:flutter/services.dart';
import 'package:satu/shared/app_colors.dart'; import 'package:satu/shared/app_colors.dart';
import 'package:satu/shared/shared_styles.dart'; import 'package:satu/shared/shared_styles.dart';
import 'package:satu/shared/ui_helpers.dart'; import 'package:satu/shared/ui_helpers.dart';
import 'package:searchable_dropdown/searchable_dropdown.dart';
import 'note_text.dart'; import 'note_text.dart';
class DropDownField extends StatefulWidget { class DropDownField extends StatefulWidget {
final bool isReadOnly; final bool isReadOnly;
final String placeholder; final String placeholder;
final String validationMessage; final String? validationMessage;
final bool smallVersion; final bool smallVersion;
final FocusNode fieldFocusNode; final FocusNode? fieldFocusNode;
final FocusNode nextFocusNode; final FocusNode? nextFocusNode;
final String additionalNote; final String? additionalNote;
final Function(String) onChanged; final Function(String)? onChanged;
final String initialValue; final String? initialValue;
final String labelText; final String? labelText;
DropDownField( DropDownField(
{ {
@required this.placeholder, required this.placeholder,
this.fieldFocusNode, this.fieldFocusNode,
this.nextFocusNode, this.nextFocusNode,
this.additionalNote, this.additionalNote,
@ -48,7 +48,7 @@ class _DropDownFieldState extends State<DropDownField> {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
if (widget.labelText != null) NoteText(widget.labelText), if (widget.labelText != null) NoteText(widget.labelText ?? ''),
Container( Container(
//height: widget.smallVersion ? 40 : fieldHeight, //height: widget.smallVersion ? 40 : fieldHeight,
constraints: BoxConstraints(minHeight: widget.smallVersion ? 40 : fieldHeight), constraints: BoxConstraints(minHeight: widget.smallVersion ? 40 : fieldHeight),
@ -56,39 +56,39 @@ class _DropDownFieldState extends State<DropDownField> {
padding: fieldPadding, padding: fieldPadding,
decoration: widget.isReadOnly ? disabledFieldDecoration : fieldDecoration, decoration: widget.isReadOnly ? disabledFieldDecoration : fieldDecoration,
child: Expanded( child: Expanded(
child: child: Container()
SearchableDropdown.single( // SearchableDropdown.single(
items: <String>['Частное лицо', 'ИП Иванов', 'ТО "Рога и копыта"', 'Network Energy'] // items: <String>['Частное лицо', 'ИП Иванов', 'ТО "Рога и копыта"', 'Network Energy']
.map<DropdownMenuItem<String>>((String value) { // .map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>( // return DropdownMenuItem<String>(
value: value, // value: value,
child: Text(value), // child: Text(value),
); // );
}).toList(), // }).toList(),
value: widget.initialValue, // value: widget.initialValue,
readOnly: widget.isReadOnly, // readOnly: widget.isReadOnly,
hint: "Контрагент", // hint: "Контрагент",
searchHint: "Укажите контрагента", // searchHint: "Укажите контрагента",
underline: Container( // underline: Container(
height: 1.0, // height: 1.0,
decoration: BoxDecoration( // decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: yellowColor, width: 3.0)) // border: Border(bottom: BorderSide(color: yellowColor, width: 3.0))
), // ),
), // ),
onChanged: (value) { // onChanged: (value) {
print(value); // print(value);
}, // },
isExpanded: true, // isExpanded: true,
), // ),
), ),
), ),
if (widget.validationMessage != null) if (widget.validationMessage != null)
NoteText( NoteText(
widget.validationMessage, widget.validationMessage ?? '',
color: Colors.red, color: Colors.red,
), ),
if (widget.additionalNote != null) verticalSpace(5), if (widget.additionalNote != null) verticalSpace(5),
if (widget.additionalNote != null) NoteText(widget.additionalNote), if (widget.additionalNote != null) NoteText(widget.additionalNote ?? ''),
verticalSpaceSmall verticalSpaceSmall
], ],
); );

View File

@ -13,23 +13,23 @@ class InputField extends StatefulWidget {
final bool search; final bool search;
final bool isReadOnly; final bool isReadOnly;
final String placeholder; final String placeholder;
final String validationMessage; final String? validationMessage;
final Function enterPressed; final Function? enterPressed;
final bool smallVersion; final bool smallVersion;
final FocusNode fieldFocusNode; final FocusNode? fieldFocusNode;
final FocusNode nextFocusNode; final FocusNode? nextFocusNode;
final TextInputAction textInputAction; final TextInputAction textInputAction;
final bool multiline; final bool multiline;
final String additionalNote; final String? additionalNote;
final Function(String) onChanged; final Function(String)? onChanged;
final TextInputFormatter formatter; final TextInputFormatter? formatter;
final String initialValue; final String? initialValue;
final String labelText; final String? labelText;
InputField( InputField(
{ {
this.controller, required this.controller,
@required this.placeholder, required this.placeholder,
this.enterPressed, this.enterPressed,
this.fieldFocusNode, this.fieldFocusNode,
this.nextFocusNode, this.nextFocusNode,
@ -51,8 +51,8 @@ class InputField extends StatefulWidget {
} }
class _InputFieldState extends State<InputField> { class _InputFieldState extends State<InputField> {
bool isPassword; late bool isPassword;
bool isSearch; late bool isSearch;
double fieldHeight = 55; double fieldHeight = 55;
@override @override
@ -61,8 +61,8 @@ class _InputFieldState extends State<InputField> {
isPassword = widget.password; isPassword = widget.password;
isSearch = widget.search; isSearch = widget.search;
if(widget.search == true) { if(widget.search == true) {
widget.fieldFocusNode.addListener(() { widget.fieldFocusNode!.addListener(() {
if(widget.fieldFocusNode.hasFocus){ if(widget.fieldFocusNode!.hasFocus){
setState(() { setState(() {
isSearch = !isSearch; isSearch = !isSearch;
}); });
@ -76,7 +76,7 @@ class _InputFieldState extends State<InputField> {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
if (widget.labelText != null) NoteText(widget.labelText), if (widget.labelText != null) NoteText(widget.labelText ?? ''),
Container( Container(
//height: widget.smallVersion ? 40 : fieldHeight, //height: widget.smallVersion ? 40 : fieldHeight,
constraints: BoxConstraints(minHeight: widget.smallVersion ? 40 : fieldHeight), constraints: BoxConstraints(minHeight: widget.smallVersion ? 40 : fieldHeight),
@ -97,16 +97,16 @@ class _InputFieldState extends State<InputField> {
onChanged: widget.onChanged, onChanged: widget.onChanged,
initialValue: widget.initialValue, initialValue: widget.initialValue,
inputFormatters: inputFormatters:
widget.formatter != null ? [widget.formatter] : null, widget.formatter != null ? [widget.formatter!] : null,
onEditingComplete: () { onEditingComplete: () {
if (widget.enterPressed != null) { if (widget.enterPressed != null) {
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
widget.enterPressed(); widget.enterPressed!();
} }
}, },
onFieldSubmitted: (value) { onFieldSubmitted: (value) {
if (widget.nextFocusNode != null) { if (widget.nextFocusNode != null) {
widget.nextFocusNode.requestFocus(); widget.nextFocusNode!.requestFocus();
} }
}, },
obscureText: isPassword, obscureText: isPassword,
@ -137,10 +137,10 @@ class _InputFieldState extends State<InputField> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
if(isSearch) { if(isSearch) {
widget.fieldFocusNode.requestFocus(); widget.fieldFocusNode!.requestFocus();
} else { } else {
FocusScope.of(context).requestFocus(new FocusNode()); //remove focus 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(() { setState(() {
isSearch = !isSearch; isSearch = !isSearch;
@ -161,11 +161,11 @@ class _InputFieldState extends State<InputField> {
), ),
if (widget.validationMessage != null) if (widget.validationMessage != null)
NoteText( NoteText(
widget.validationMessage, widget.validationMessage ?? '',
color: Colors.red, color: Colors.red,
), ),
if (widget.additionalNote != null) verticalSpace(5), if (widget.additionalNote != null) verticalSpace(5),
if (widget.additionalNote != null) NoteText(widget.additionalNote), if (widget.additionalNote != null) NoteText(widget.additionalNote ?? ''),
verticalSpaceSmall verticalSpaceSmall
], ],
); );

View File

@ -3,9 +3,9 @@ import 'package:satu/shared/app_colors.dart';
class NoteText extends StatelessWidget { class NoteText extends StatelessWidget {
final String text; final String text;
final TextAlign textAlign; final TextAlign? textAlign;
final Color color; final Color? color;
final double fontSize; final double? fontSize;
const NoteText(this.text, {this.textAlign, this.color, this.fontSize}); const NoteText(this.text, {this.textAlign, this.color, this.fontSize});
@override @override

View File

@ -1,41 +1,20 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: 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: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0" version: "2.6.1"
auto_size_text: auto_size_text:
dependency: "direct main" dependency: "direct main"
description: description:
name: auto_size_text name: auto_size_text
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "3.0.0-nullsafety.0"
barcode_scan:
dependency: "direct main"
description:
name: barcode_scan
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -78,62 +57,41 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0" version: "1.15.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.5" version: "3.0.1"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.2"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.0.3"
device_info: device_info:
dependency: "direct main" dependency: "direct main"
description: description:
name: device_info name: device_info
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.2"
device_info_platform_interface: device_info_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: device_info_platform_interface name: device_info_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.1"
equatable: equatable:
dependency: "direct main" dependency: "direct main"
description: description:
name: equatable name: equatable
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.3"
esc_pos_utils:
dependency: "direct main"
description:
name: esc_pos_utils
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -147,21 +105,14 @@ packages:
name: ffi name: ffi
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.1.2"
file: file:
dependency: transitive dependency: transitive
description: description:
name: file name: file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.0" version: "6.1.2"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.11"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -180,7 +131,7 @@ packages:
name: flutter_screenutil name: flutter_screenutil
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.0.0" version: "5.0.0+2"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -191,34 +142,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" 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: get_it:
dependency: "direct main" dependency: "direct main"
description: description:
name: get_it name: get_it
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "7.1.2" version: "7.1.3"
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"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
@ -233,13 +163,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.0" 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: implicitly_animated_reorderable_list:
dependency: "direct main" dependency: "direct main"
description: description:
@ -274,7 +197,7 @@ packages:
name: mask_text_input_formatter name: mask_text_input_formatter
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.1" version: "2.0.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -288,7 +211,7 @@ packages:
name: material_design_icons_flutter name: material_design_icons_flutter
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.5955" version: "5.0.5955-rc.1"
material_floating_search_bar: material_floating_search_bar:
dependency: "direct main" dependency: "direct main"
description: description:
@ -323,7 +246,7 @@ packages:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.1" version: "2.0.2"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
@ -344,7 +267,7 @@ packages:
name: path_provider_platform_interface name: path_provider_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.1"
path_provider_windows: path_provider_windows:
dependency: transitive dependency: transitive
description: description:
@ -358,14 +281,7 @@ packages:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.11.0" version: "1.11.1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -379,7 +295,7 @@ packages:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.3" version: "2.0.0"
process: process:
dependency: transitive dependency: transitive
description: description:
@ -387,13 +303,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.2.1" version: "4.2.1"
protobuf:
dependency: transitive
description:
name: protobuf
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
provider: provider:
dependency: "direct main" dependency: "direct main"
description: description:
@ -407,7 +316,7 @@ packages:
name: qr name: qr
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.1.0"
qr_flutter: qr_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
@ -450,20 +359,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.1" 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: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
name: shared_preferences name: shared_preferences
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.0.6"
shared_preferences_linux: shared_preferences_linux:
dependency: transitive dependency: transitive
description: description:
@ -510,7 +412,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
sqflite: sqflite:
dependency: "direct main" dependency: "direct main"
description: description:
@ -566,7 +468,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19" version: "0.3.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -580,49 +482,49 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.7.10" version: "6.0.7"
url_launcher_linux: url_launcher_linux:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_linux name: url_launcher_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1+4" version: "2.0.0"
url_launcher_macos: url_launcher_macos:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_macos name: url_launcher_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1+9" version: "2.0.0"
url_launcher_platform_interface: url_launcher_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_platform_interface name: url_launcher_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.9" version: "2.0.3"
url_launcher_web: url_launcher_web:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_web name: url_launcher_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.5+1" version: "2.0.1"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_windows name: url_launcher_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.1+3" version: "2.0.0"
uuid: uuid:
dependency: "direct main" dependency: "direct main"
description: description:
name: uuid name: uuid
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.2" version: "3.0.4"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@ -636,7 +538,7 @@ packages:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.2.4"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
@ -644,13 +546,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.0" version: "0.2.0"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.1"
sdks: sdks:
dart: ">=2.12.0 <3.0.0" dart: ">=2.13.0 <3.0.0"
flutter: ">=1.24.0-10" flutter: ">=2.0.0"

View File

@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1 version: 1.0.0+1
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.12.0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
@ -41,21 +41,18 @@ dependencies:
http: ^0.13.3 http: ^0.13.3
sqflite: ^2.0.0+3 sqflite: ^2.0.0+3
path_provider: ^2.0.1 path_provider: ^2.0.1
material_design_icons_flutter: ^4.0.5955 material_design_icons_flutter: 5.0.5955-rc.1
intl: ^0.17.0 intl: ^0.17.0
barcode_scan: ^3.0.1
device_info: ^2.0.0 device_info: ^2.0.0
auto_size_text: ^2.1.0 auto_size_text: ^3.0.0-nullsafety.0
url_launcher: ^5.7.10 url_launcher: ^6.0.7
qr_flutter: ^4.0.0 qr_flutter: ^4.0.0
mask_text_input_formatter: ^1.2.1 mask_text_input_formatter: ^2.0.0
flutter_screenutil: ^5.0.0 flutter_screenutil: ^5.0.0
shared_preferences: ^2.0.5 shared_preferences: ^2.0.5
searchable_dropdown: ^1.1.3
material_floating_search_bar: ^0.3.4 material_floating_search_bar: ^0.3.4
implicitly_animated_reorderable_list: ^0.4.0 implicitly_animated_reorderable_list: ^0.4.0
esc_pos_utils: ^1.0.0 uuid: ^3.0.4
uuid: ^2.2.2 #for esc_pos_utils: ^1.0.0
charset_converter: ^2.0.0 charset_converter: ^2.0.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: