start new ui on figma

null-safety-migration
suvaissov 2021-06-30 21:57:18 +06:00
parent 036a4e0d87
commit 05cf3f4284
25 changed files with 451 additions and 344 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 KiB

View File

@ -49,17 +49,21 @@ 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 != null) {
_navigation.replace(LoginViewRoute); if (state.auth?.operation == false) {
} else {
AuthResponse response = await _api.auth(state.auth!.token!);
if(response.operation!){
_api.token = response.token!;
_navigation.replace(MainViewRoute);
_afterAuth(store);
} else {
_navigation.replace(LoginViewRoute); _navigation.replace(LoginViewRoute);
} else {
AuthResponse response = await _api.auth(state.auth?.token ?? '');
if (response.operation!) {
_api.token = response.token!;
_navigation.replace(MainViewRoute);
_afterAuth(store);
} else {
_navigation.replace(LoginViewRoute);
}
} }
} else {
_navigation.replace(LoginViewRoute);
} }
} catch (e) { } catch (e) {
print(e); print(e);

View File

@ -36,13 +36,13 @@ class MainApplication extends StatelessWidget {
return StoreProvider<AppState>( return StoreProvider<AppState>(
store: Redux.store!, store: Redux.store!,
child: ScreenUtilInit( child: ScreenUtilInit(
designSize: Size(411.43, 683.43), designSize: Size(375, 812),
builder: () => MaterialApp( builder: () => MaterialApp(
theme: ThemeData( theme: ThemeData(
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
primaryColor: whiteColor, primaryColor: whiteColor,
accentColor: yellowColor, accentColor: primaryColor,
scaffoldBackgroundColor: fillColor, scaffoldBackgroundColor: backgroundColor
// textTheme: GoogleFonts.robotoTextTheme( // textTheme: GoogleFonts.robotoTextTheme(
// Theme.of(context).textTheme, // Theme.of(context).textTheme,
// ) // )

View File

@ -1,38 +1,22 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
const Color backgroundColor = Color.fromRGBO(255, 255, 255, 1); const Color backgroundColor = Color.fromRGBO(235, 239, 248, 1);
// const Color fillColor = Color.fromRGBO(248, 248, 248, 1); const Color primaryColor = Color.fromRGBO(255, 196, 45, 1);
const Color fillColor = Color.fromRGBO(252, 252, 252, 1);
const Color primaryColor = Color.fromRGBO(51, 122, 183, 1);
const Color halykColor = Color.fromRGBO(0, 118, 59, 1); const Color dangerColor = Color.fromRGBO(243, 98, 88, 1);
const Color successColor = Color.fromRGBO(39, 174, 96, 1);
const Color menuColor = Color.fromRGBO(0, 75, 120, 1);
const Color redColor = Color.fromRGBO(217, 83, 79, 1);
const Color greenColor = Color.fromRGBO(92, 184, 92, 1);
const Color whiteColor = Color.fromRGBO(255, 255, 255, 1); const Color whiteColor = Color.fromRGBO(255, 255, 255, 1);
const Color blackColor = Color.fromRGBO(0, 0, 0, 1); const Color blackColor = Color.fromRGBO(35, 35, 35, 1);
const Color yellowColor = Color.fromRGBO(250, 175, 0, 1);
const Color purpleColor = Color.fromRGBO(118, 122, 230, 1); const Color shadowColor = Color.fromRGBO(72, 72, 72, 0.25);
const Color purpleSecondColor = Color.fromRGBO(140, 143, 236, 1);
const Color textColor = Color.fromRGBO(51, 51, 51, 1);
const Color primaryGrStartColor = Color.fromRGBO(255, 220, 96, 1);
const Color primaryGrEndColor = Color.fromRGBO(237, 137, 44, 1);
const Color shadowColor = Color.fromRGBO(80, 137, 196, 0.47); const Color textColor = Color.fromRGBO(69, 69, 69, 1);
const Color cardShadowColor = Color.fromRGBO(228, 229, 231, 0.25); const Color placeholderColor = Color.fromRGBO( 153, 153, 153, 1);
const Color blueColor = Color.fromRGBO(96, 205, 255, 1); const Color disableColor = Color.fromRGBO( 221, 221, 221, 1);
const Color blueColorLigth = Color.fromRGBO(96, 205, 255, 0.536);
const Color textColorLight = Color.fromRGBO(162, 171, 191, 1);
const Color dayColor = Color.fromRGBO(52, 72, 94, 0.536);
const Color dayColorLight = Color.fromRGBO(255, 228, 231, 1);

View File

@ -1,18 +1,23 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'app_colors.dart'; import 'app_colors.dart';
// Box Decorations // Box Decorations
BoxDecoration fieldDecoration = BoxDecoration(color: whiteColor);
BoxDecoration fieldDecoration =
BoxDecoration(borderRadius: BorderRadius.circular(5) , color: Colors.white);
BoxDecoration disabledFieldDecoration = BoxDecoration( BoxDecoration disabledFieldDecoration = BoxDecoration(
borderRadius: BorderRadius.circular(5), color: Colors.grey[100]); borderRadius: BorderRadius.circular(5), color: Colors.grey[100]);
// Field Variables const LinearGradient primaryGradient = LinearGradient(
colors: [
primaryGrStartColor,
primaryGrEndColor,
],
begin: const FractionalOffset(0.0, 0.0),
end: const FractionalOffset(1.0, 0.0),
stops: [0.0, 1.0],
tileMode: TileMode.clamp);
// Field Variables
const double fieldHeight = 55; const double fieldHeight = 55;
const double smallFieldHeight = 40; const double smallFieldHeight = 40;
const double inputFieldBottomMargin = 30; const double inputFieldBottomMargin = 30;
@ -22,26 +27,14 @@ const EdgeInsets largeFieldPadding =
const EdgeInsets.symmetric(horizontal: 15, vertical: 15); const EdgeInsets.symmetric(horizontal: 15, vertical: 15);
// Text Variables // Text Variables
const TextStyle productTextStyle = const TextStyle( fontWeight: FontWeight.w600, color: Colors.black, fontSize: 15);
const TextStyle productSubTextStyle = const TextStyle( fontWeight: FontWeight.w400, color: Colors.black54, fontSize: 12);
const TextStyle buttonTitleTextStyle = const TextStyle(
fontWeight: FontWeight.w700, color: whiteColor, fontSize: 14);
const TextStyle buttonTitleTextBlackStyle = const TextStyle(
fontWeight: FontWeight.w700, color: Colors.black, fontSize: 14);
const TextStyle buttonBigTitleTextStyle = const TextStyle(
fontWeight: FontWeight.w700,
color: whiteColor,
fontSize: 22,
);
const TextStyle dropDownTradeTypeTextStyle = const TextStyle dropDownTradeTypeTextStyle =
TextStyle(color: Colors.black54, fontWeight: FontWeight.bold, fontSize: 24); TextStyle(color: Colors.black54, fontWeight: FontWeight.bold, fontSize: 24);
// Box Shadow // Box Shadow
const BoxShadow mainShadowBox =
BoxShadow(blurRadius: 16, color: shadowColor, offset: Offset(0, 5));
const BoxShadow buttonShadowBox = const BoxShadow buttonShadowBox =
BoxShadow(blurRadius: 5, color: Colors.grey, offset: Offset(0, 1)); BoxShadow(blurRadius: 10, color: shadowColor, offset: Offset(0, 4));
const BoxShadow cardShadowBox = const BoxShadow cardShadowBox =
BoxShadow(blurRadius: 5, color: Colors.black26, offset: Offset(0, 5)); BoxShadow(blurRadius: 3, color: Color.fromRGBO(0, 0, 0, 0.15), offset: Offset(0, 1));

View File

@ -36,7 +36,7 @@ class _AddProductViewState extends State<AddProductView> {
_searchTextController = TextEditingController(); _searchTextController = TextEditingController();
_searchTextController.addListener(() { _searchTextController.addListener(() {
if(_searchTextController.text.isNotEmpty){ if(_searchTextController.text.isNotEmpty){
searchByField(_searchTextController.text); searchByField(_searchTextController.text);
} else { } else {
reset(); reset();
} }
@ -93,8 +93,10 @@ class _AddProductViewState extends State<AddProductView> {
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);
} ,
); );
}, },
), ),
@ -119,12 +121,12 @@ class _AddProductViewState extends State<AddProductView> {
List<Widget> actions() { List<Widget> actions() {
return [ return [
if(_history!.length > 1) if(_history!.length > 1)
FlatButton(onPressed: () { TextButton(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),),) TextButton(onPressed: reset, child: Text('Сбросить', style: TextStyle(color: Colors.black),),)
]; ];
} }

View File

@ -15,7 +15,7 @@ class AddCategoryListItem extends StatelessWidget {
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),
@ -24,17 +24,18 @@ class AddCategoryListItem extends StatelessWidget {
child: Center( child: Center(
child: Text( child: Text(
name!, name!,
style: productTextStyle, style: TextStyle(
fontWeight: FontWeight.w600, color: Colors.black, fontSize: 15),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 3, maxLines: 3,
), ),
) )
), ),
), ),
tileColor: !isOdd! ? fillColor : backgroundColor, tileColor: !isOdd! ? whiteColor : backgroundColor,
trailing: Icon( trailing: Icon(
Icons.arrow_right, Icons.arrow_right,
color: yellowColor, color: primaryColor,
), ),
), ),
); );

View File

@ -19,7 +19,7 @@ class AddProductListItem extends StatelessWidget {
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,15 @@ 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: TextStyle(
fontWeight: FontWeight.w600, color: Colors.black, fontSize: 15), overflow: TextOverflow.ellipsis, maxLines: 2,),
verticalSpaceTiny, verticalSpaceTiny,
if(ean!=null) if(ean!=null)
Text('Штрих-код: $ean' , style: productSubTextStyle,), Text('Штрих-код: $ean' , style: TextStyle(
fontWeight: FontWeight.w600, color: Colors.black, fontSize: 12),),
if(categoryName!=null) if(categoryName!=null)
Text(categoryName!, style: productSubTextStyle,), Text(categoryName!, style: TextStyle(
fontWeight: FontWeight.w600, color: Colors.black, fontSize: 12),),
], ],
), ),
), ),
@ -54,7 +57,7 @@ class AddProductListItem extends StatelessWidget {
], ],
), ),
), ),
tileColor: !isOdd! ? fillColor : backgroundColor, tileColor: !isOdd! ? whiteColor : backgroundColor,
), ),
); );
} }

View File

@ -3,6 +3,7 @@ import 'dart:ui';
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';
import 'package:flutter_screenutil/flutter_screenutil.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/user_actions.dart'; import 'package:satu/core/redux/actions/user_actions.dart';
import 'package:satu/core/redux/state/user_state.dart'; import 'package:satu/core/redux/state/user_state.dart';
@ -13,6 +14,7 @@ import 'package:satu/shared/app_colors.dart';
import 'package:satu/shared/ui_helpers.dart'; import 'package:satu/shared/ui_helpers.dart';
import 'package:satu/widgets/buttons/busy_button.dart'; import 'package:satu/widgets/buttons/busy_button.dart';
import 'package:satu/widgets/fields/input_field.dart'; import 'package:satu/widgets/fields/input_field.dart';
import 'package:satu/widgets/ui/logo.dart';
class LoginView extends StatefulWidget { class LoginView extends StatefulWidget {
@ -28,17 +30,15 @@ class _LoginViewState extends State<LoginView> {
final FocusNode passwordNode = new FocusNode(); final FocusNode passwordNode = new FocusNode();
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
final DialogService _dialogService = locator<DialogService>(); final DialogService _dialogService = locator<DialogService>();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
emailController = TextEditingController(text: 'test11@gmail.com'); emailController = TextEditingController(text: 'test11@gmail.com');
passwordController = TextEditingController(text: 'qwe123'); passwordController = TextEditingController();
} }
@override @override
@ -55,77 +55,44 @@ class _LoginViewState extends State<LoginView> {
converter: (store) => store.state.userState!, converter: (store) => store.state.userState!,
builder: (context, vm) { builder: (context, vm) {
return Scaffold( return Scaffold(
key: _scaffoldKey, body: Column(
backgroundColor: fillColor, mainAxisSize: MainAxisSize.max,
body: Padding( mainAxisAlignment: MainAxisAlignment.center,
padding: const EdgeInsets.symmetric(horizontal: 50), crossAxisAlignment: CrossAxisAlignment.center,
child: Column( children: <Widget>[
mainAxisSize: MainAxisSize.max, LogoSatu(),
mainAxisAlignment: MainAxisAlignment.center, InputField(
crossAxisAlignment: CrossAxisAlignment.center, placeholder: 'Введите почту',
children: <Widget>[ controller: emailController,
Stack( textInputType: TextInputType.emailAddress,
alignment: Alignment.bottomLeft, nextFocusNode: passwordNode,
children: <Widget>[ ),
SizedBox( verticalSpaceSmall,
height: 150, InputField(
child: Image.asset('assets/images/logo.png'), placeholder: 'Введите пароль',
), password: true,
Positioned( controller: passwordController,
child: Text( fieldFocusNode: passwordNode,
'онлайн касса', enterPressed: _pressBtnEnter,
style: TextStyle(fontWeight: FontWeight.bold), textInputAction: TextInputAction.done,
), ),
bottom: 23.0, verticalSpaceMedium,
left: 25.0, Padding(
), padding: EdgeInsets.only( left: 45.sp, right: 45.sp, top: 30.sp ),
], child: BusyButton(
title: 'ВОЙТИ',
busy: vm.isLoading!,
onPressed: _pressBtnEnter,
), ),
),
InputField( verticalSpaceLarge,
placeholder: 'Электронная почта', IconButton(
controller: emailController, icon: Icon(MdiIcons.qrcodeScan),
textInputType: TextInputType.emailAddress, iconSize: ScreenUtil().setSp(40.0),
nextFocusNode: passwordNode, tooltip: "Scan",
), onPressed: scan,
verticalSpaceSmall, )
InputField( ],
placeholder: 'Пароль',
password: true,
controller: passwordController,
fieldFocusNode: passwordNode,
enterPressed: _pressBtnEnter,
textInputAction: TextInputAction.done,
),
verticalSpaceMedium,
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
width: 150,
child: BusyButton(
title: 'Войти',
busy: vm.isLoading!,
onPressed: _pressBtnEnter,
mainColor: yellowColor,
),
)
],
),
verticalSpaceLarge,
// TextLink(
// 'Регистрация',
// onPressed: () {},
// ),
IconButton(
icon: Icon(MdiIcons.qrcodeScan),
iconSize: 40,
tooltip: "Scan",
onPressed: scan,
)
],
),
)); ));
}); });
} }

View File

@ -13,7 +13,8 @@ class BuyView extends StatelessWidget {
body: Center( body: Center(
child: Text( child: Text(
'Index 2: School', 'Index 2: School',
style: productTextStyle, style: TextStyle(
fontWeight: FontWeight.w600, color: Colors.black, fontSize: 15),
), ),
), ),
); );

View File

@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:satu/shared/app_colors.dart';
import 'package:satu/shared/shared_styles.dart';
import 'package:satu/widgets/dialog/modal_select_dialog.dart';
class ContragentSelectBar extends StatelessWidget {
final String value;
const ContragentSelectBar({Key? key, required this.value}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(color: whiteColor),
child: Material(
type: MaterialType.transparency,
child: InkWell(
onTap: () {},
child: Padding(
padding: EdgeInsets.symmetric( vertical: 8.w, horizontal: 15.w ),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Контрагент',
style: TextStyle(fontSize: ScreenUtil().setSp(10), color: placeholderColor),
),
Text(
value,
style: TextStyle(fontSize: ScreenUtil().setSp(14), color: textColor),
),
],
)),
Center(
child: Icon(Icons.arrow_forward_ios, size: ScreenUtil().setSp(14),),
)
],
),
))),
);
}
}

View File

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:satu/core/redux/actions/sell_actions.dart'; import 'package:satu/core/redux/actions/sell_actions.dart';
import 'package:satu/core/redux/store.dart'; import 'package:satu/core/redux/store.dart';
import 'package:satu/core/services/navigator_service.dart'; import 'package:satu/core/services/navigator_service.dart';
@ -43,12 +44,11 @@ class _ProductListItemState extends State<ProductListItem> {
return Dismissible( return Dismissible(
background: Container( background: Container(
alignment: AlignmentDirectional.centerEnd, alignment: AlignmentDirectional.centerEnd,
color: redColor, color: dangerColor,
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
'Удалить', 'Удалить',
style: buttonTitleTextStyle,
), ),
), ),
), ),
@ -61,8 +61,8 @@ class _ProductListItemState extends State<ProductListItem> {
title: const Text("Внимание"), title: const Text("Внимание"),
content: Text("Удалить товар \"${this.widget.name}\" - ${widget.count} ед. ?"), content: Text("Удалить товар \"${this.widget.name}\" - ${widget.count} ед. ?"),
actions: <Widget>[ actions: <Widget>[
FlatButton(onPressed: () => Navigator.of(context).pop(true), child: const Text("Удалить")), TextButton(onPressed: () => Navigator.of(context).pop(true), child: const Text("Удалить")),
FlatButton( TextButton(
onPressed: () => Navigator.of(context).pop(false), onPressed: () => Navigator.of(context).pop(false),
child: const Text("Отмена"), child: const Text("Отмена"),
), ),
@ -77,57 +77,113 @@ class _ProductListItemState extends State<ProductListItem> {
}, },
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),
title: Padding( title: Row(
padding: const EdgeInsets.only(top: 4.0), crossAxisAlignment: CrossAxisAlignment.start,
child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, children: [
mainAxisAlignment: MainAxisAlignment.spaceBetween, Expanded(
children: [ child: Column(
Flexible( crossAxisAlignment: CrossAxisAlignment.start,
flex: 3, children: [
child: Column( Text(
crossAxisAlignment: CrossAxisAlignment.start, widget.name ?? '',
children: [ style: TextStyle(fontSize: 12.sp, color: textColor),
overflow: TextOverflow.ellipsis,
maxLines: 2,
),
verticalSpaceTiny,
Text(
'Штрих-код: ${widget.ean}',
style: TextStyle(color: placeholderColor, fontSize: 8.sp),
),
if (widget.categoryName != null)
Text( Text(
widget.name ?? '', 'Категория: ${widget.categoryName}',
style: const TextStyle(fontWeight: FontWeight.w500), style: TextStyle(color: placeholderColor, fontSize: 8.sp),
overflow: TextOverflow.ellipsis,
maxLines: 2,
),
verticalSpaceTiny,
Text(
'Штрих-код: ${widget.ean}',
style: productSubTextStyle,
),
Text(
widget.categoryName ?? '',
style: productSubTextStyle,
) )
], ],
),
), ),
Flexible( ),
flex: 1, SizedBox(
child: Column( width: 100.w,
crossAxisAlignment: CrossAxisAlignment.end, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.end,
Text( children: [
Padding(
padding: const EdgeInsets.only(bottom: 3.0),
child: Text(
'${widget.price}', '${widget.price}',
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold), style: TextStyle(fontSize: 12.sp, fontWeight: FontWeight.w500, color: textColor),
), ),
Text( ),
'${widget.count} шт', Row(
style: const TextStyle(fontSize: 12), crossAxisAlignment: CrossAxisAlignment.center,
), mainAxisAlignment: MainAxisAlignment.end,
], children: [
), Material(
color: Colors.transparent,
borderRadius: BorderRadius.circular(ScreenUtil().radius(5)),
child: InkWell(
onTap: () {},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().radius(5)),
border: Border.all(width: 1.0.sp, color: successColor)),
child: Icon(
Icons.add,
color: successColor,
size: 20.0.sp,
),
),
),
),
Container(
width: 45.w,
margin: EdgeInsets.symmetric( horizontal: 5.w),
padding: EdgeInsets.symmetric( vertical: 6.0.w ),
decoration: BoxDecoration(
color: whiteColor,
borderRadius: BorderRadius.circular(ScreenUtil().radius(5)),
boxShadow: [cardShadowBox]),
child: SizedBox(
width: 45.w,
child: Text(
'${widget.count} шт',
style: TextStyle(
fontSize: 8.sp,
color: placeholderColor
),
textAlign: TextAlign.center,
),
),
),
Material(
color: Colors.transparent,
borderRadius: BorderRadius.circular(ScreenUtil().radius(5)),
child: InkWell(
onTap: () {},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().radius(5)),
border: Border.all(width: 1.0.sp, color: widget.count! <= 1.0 ? disableColor : dangerColor)),
child: Icon(
Icons.remove,
color: widget.count! <= 1.0 ? disableColor : dangerColor,
size: 20.0.sp,
),
),
),
),
],
),
],
), ),
], ),
), ],
), ),
tileColor: !widget.isOdd! ? fillColor : backgroundColor, tileColor: !widget.isOdd! ? whiteColor : whiteColor,
), ),
); );
} }

View File

@ -12,30 +12,55 @@ class ProductsAppBar extends StatelessWidget implements PreferredSizeWidget {
final double 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(
elevation: elevation, elevation: elevation,
color: backgroundColor, color: backgroundColor,
child: Column( child: Container(
children: [ decoration: BoxDecoration(
AppBar( image: DecorationImage(
title: Text(title ?? ''), image: AssetImage('assets/images/top_bar_bg.png'),
backgroundColor: Colors.transparent, fit: BoxFit.fitWidth,
elevation: 0.0, alignment: FractionalOffset.topLeft,
leading: IconButton(
icon: Icon(Icons.menu, color: yellowColor,),
onPressed: () {
locator<NavigatorService>().scaffoldDrawerKey.currentState!.openDrawer();
},
),
actions: actions
,
), ),
if(child !=null && childHeight! > 0) ),
child!, child: Column(
], crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppBar(
title: Text(title ?? ''),
centerTitle: true,
backgroundColor: Colors.transparent,
elevation: 0.0,
leading: IconButton(
icon: Icon(
Icons.menu,
color: blackColor,
),
onPressed: () {
locator<NavigatorService>()
.scaffoldDrawerKey
.currentState!
.openDrawer();
},
),
actions: actions,
),
if (child != null && childHeight! > 0) child!,
],
),
), ),
); );
} }

View File

@ -1,73 +1,36 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.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';
class ProductHeaderBar extends StatelessWidget { class ProductHeaderBar extends StatelessWidget {
final int count; final int count;
final num sum; final num sum;
const ProductHeaderBar({Key? key, required this.count, required 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) {
return Padding( return Padding(
padding: const EdgeInsets.only( padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.w),
bottom: 16.00,
left: 8.0,
right: 8.0,
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Text(
mainAxisAlignment: MainAxisAlignment.spaceBetween, 'Итого: $sum тнг',
children: [ style: TextStyle(
Text( fontWeight: FontWeight.w700,
'Контрагент: Частное лицо', color: blackColor,
style: productTextStyle, fontSize: ScreenUtil().setSp(20)),
),
IconButton(
icon: Icon(
Icons.edit,
color: yellowColor,
),
onPressed: () {
List<int> selected = [1];
showDialog(
context: context,
builder: (BuildContext context) {
return Container();
// return DropdownDialog(
// dialogBox: true,
// multipleSelection: false,
// items: <String>['Частное лицо', 'ИП Иванов', 'ТО "Рога и копыта"', 'Network Energy']
// .map<DropdownMenuItem<String>>((String value) {
// return DropdownMenuItem<String>(
// value: value,
// child: Text(value),
// );
// }).toList(),
// selectedItems: selected,
// hint: Text('Выберите контрагента'),
// closeButton: 'Отмена',
// );
}).then((value) => {
print(selected)
});
}),
],
), ),
Row( Text(
mainAxisAlignment: MainAxisAlignment.spaceBetween, 'Товаров выбрано: $count',
children: [ style: TextStyle(
Text( fontWeight: FontWeight.w400,
'Всего: $count наим.', color: blackColor,
style: productTextStyle, fontSize: ScreenUtil().setSp(15)),
),
Text('Итого: $sum тнг', style: productTextStyle),
],
), ),
], ],
), ),

View File

@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:satu/core/redux/actions/sell_actions.dart';
import 'package:satu/core/redux/store.dart';
import 'package:satu/shared/app_colors.dart';
import 'package:satu/shared/shared_styles.dart';
import 'package:satu/widgets/dialog/modal_select_dialog.dart';
class ProductsTitleBarBar extends StatelessWidget {
final bool itemsExist;
const ProductsTitleBarBar({Key? key, required this.itemsExist}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
child: Padding(
padding: EdgeInsets.only(left: 15.w, right: 5.w, top: 30.w),
child: Row(
children: [
Expanded(
child: Padding(
padding: EdgeInsets.symmetric( vertical: 16.w ),
child: Text(
'Товары',
style: TextStyle(fontSize: ScreenUtil().setSp(14), color: placeholderColor),
),
)),
if(itemsExist)
TextButton(
onPressed: () {
Redux.store!.dispatch(removeAllSellData);
},
child: Text(
'Удалить все',
style: TextStyle(fontSize: 14.sp, color: dangerColor),
))
],
),
),
);
}
}

View File

@ -14,11 +14,12 @@ import 'package:satu/shared/ui_helpers.dart';
import 'package:satu/views/work/tabs/component/product_list_item.dart'; import 'package:satu/views/work/tabs/component/product_list_item.dart';
import 'package:satu/views/work/tabs/component/products_app_bar.dart'; import 'package:satu/views/work/tabs/component/products_app_bar.dart';
import 'package:satu/views/work/tabs/component/products_header_bar.dart'; import 'package:satu/views/work/tabs/component/products_header_bar.dart';
import 'package:satu/views/work/tabs/component/products_title_bar.dart';
import 'package:satu/views/work/tabs/utils/ProductUtils.dart'; import 'package:satu/views/work/tabs/utils/ProductUtils.dart';
import 'component/contagent_select_bar.dart';
class SellView extends StatelessWidget { class SellView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return StoreConnector<AppState, SellState>( return StoreConnector<AppState, SellState>(
@ -27,31 +28,38 @@ class SellView extends StatelessWidget {
return Scaffold( return Scaffold(
appBar: ProductsAppBar( appBar: ProductsAppBar(
title: 'Продажа', title: 'Продажа',
actions: actions(),
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: 60,
), ),
body: ListView.builder( body: Column(
physics: BouncingScrollPhysics(), children: [
itemCount: state.items!.length, ContragentSelectBar(
itemBuilder: (BuildContext context, int index) { value: 'Частное лицо',
ProductDao product = state.items!.elementAt(index); ),
return ProductListItem( ProductsTitleBarBar(itemsExist: state.items!.isNotEmpty),
key: UniqueKey(), ListView.builder(
ean: product.eanCode, shrinkWrap: true,
isOdd: index % 2 == 0, physics: BouncingScrollPhysics(),
name: product.productName, itemCount: state.items!.length,
price: product.price, itemBuilder: (BuildContext context, int index) {
count: product.count, ProductDao product = state.items!.elementAt(index);
categoryName: product.categoryName, return ProductListItem(
transactionId: product.transactionId, key: UniqueKey(),
); ean: product.eanCode,
}, isOdd: index % 2 == 0,
name: product.productName,
price: product.price,
count: product.count,
categoryName: product.categoryName,
transactionId: product.transactionId,
);
},
),
],
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: floatingActionButtonRender(), floatingActionButton: floatingActionButtonRender(),
@ -64,37 +72,36 @@ class SellView extends StatelessWidget {
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: EdgeInsets.all(15.w),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
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: successColor,
onPressed: () => print('check'), onPressed: () => print('check'),
child: Icon( child: Icon(Icons.check, color: whiteColor, size: 35.sp),
Icons.check, )),
color: whiteColor,
size: 30.sp
),
)),
Column( Column(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
FloatingActionButton( FloatingActionButton(
elevation: 2, elevation: 2,
onPressed: () => locator<NavigatorService>().push(AddProductViewRoute), onPressed: () => locator<NavigatorService>().push(AddProductViewRoute),
child: Icon(Icons.add, size: 30.sp,), child: Icon(
Icons.add_rounded,
size: 45.sp,
color: whiteColor,
),
), ),
verticalSpaceMedium, verticalSpaceMedium,
FloatingActionButton( FloatingActionButton(
elevation: 2, elevation: 2,
onPressed: () => locator<NavigatorService>().push(AddByBarcodeViewRoute), onPressed: () => locator<NavigatorService>().push(AddByBarcodeViewRoute),
child: Icon(Icons.qr_code_rounded, size: 30.sp), child: Icon(Icons.qr_code_rounded, size: 35.sp, color: whiteColor),
), ),
], ],
) )
@ -103,17 +110,4 @@ class SellView extends StatelessWidget {
); );
}); });
} }
List<Widget> actions() {
return [
Padding(
padding: const EdgeInsets.all(8.0),
child: IconButton(
icon: Icon(Icons.delete, size: 30.0, color: yellowColor),
onPressed: () {
Redux.store!.dispatch(removeAllSellData);
}),
)
];
}
} }

View File

@ -61,7 +61,7 @@ class _WorkViewState extends State<WorkView> {
], ],
currentIndex: _selectedIndex, currentIndex: _selectedIndex,
unselectedItemColor: Colors.black54, unselectedItemColor: Colors.black54,
selectedItemColor: yellowColor, selectedItemColor: primaryColor,
selectedLabelStyle: const TextStyle( fontWeight: FontWeight.w600 ), selectedLabelStyle: const TextStyle( fontWeight: FontWeight.w600 ),
backgroundColor: whiteColor, backgroundColor: whiteColor,
elevation: 8.0, elevation: 8.0,

View File

@ -1,5 +1,6 @@
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.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';
@ -29,12 +30,9 @@ class _BusyButtonState extends State<BusyButton> {
return AnimatedContainer( return AnimatedContainer(
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
decoration: BoxDecoration( decoration: BoxDecoration(
color: widget.enabled gradient: primaryGradient,
? (widget.mainColor ?? primaryColor) borderRadius: BorderRadius.circular(5),
: widget.mainColor?.withOpacity(0.2) ?? boxShadow: [buttonShadowBox]),
primaryColor.withOpacity(0.2),
borderRadius: BorderRadius.circular(7),
boxShadow: [cardShadowBox]),
child: Material( child: Material(
type: MaterialType.transparency, type: MaterialType.transparency,
child: InkWell( child: InkWell(
@ -43,25 +41,22 @@ class _BusyButtonState extends State<BusyButton> {
widget.onPressed(); widget.onPressed();
}, },
child: AnimatedContainer( child: AnimatedContainer(
height: widget.busy ? 45 : 45, height: 40.h,
//width: widget.busy ? 40 : 40,
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
alignment: Alignment.center, alignment: Alignment.center,
margin: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0 //margin: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0 ),
//horizontal: widget.busy ? 10 : 10,
//vertical: widget.busy ? 10 : 10
),
child: !widget.busy child: !widget.busy
? AutoSizeText( ? Text(
widget.title, widget.title,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: buttonTitleTextBlackStyle, style: TextStyle(
minFontSize: 2, fontWeight: FontWeight.w400, color: blackColor, fontSize: 12.sp ),
//minFontSize: 2,
maxLines: 1, maxLines: 1,
) )
: SizedBox( : SizedBox(
width: 30, width: 20.h,
height: 30, height: 20.h,
child: CircularProgressIndicator( child: CircularProgressIndicator(
strokeWidth: 2, strokeWidth: 2,
valueColor: valueColor:

View File

@ -57,14 +57,14 @@ class _DialogManagerState extends State<DialogManager> {
content: Text(request.description!), content: Text(request.description!),
actions: <Widget>[ actions: <Widget>[
if (isConfirmationDialog) if (isConfirmationDialog)
FlatButton( TextButton(
child: Text(request.cancelTitle!), child: Text(request.cancelTitle!),
onPressed: () { onPressed: () {
_dialogService _dialogService
.dialogComplete(DialogResponse(confirmed: false)); .dialogComplete(DialogResponse(confirmed: false));
}, },
), ),
FlatButton( TextButton(
child: Text(request.buttonTitle!), child: Text(request.buttonTitle!),
onPressed: () { onPressed: () {
_dialogService _dialogService

View File

@ -66,7 +66,7 @@ class _DialogModalSelectState extends State<DialogModalSelect> {
), ),
Align( Align(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
child: FlatButton( child: TextButton(
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },

View File

@ -69,7 +69,7 @@ class AppDrawer extends StatelessWidget {
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
decoration: BoxDecoration( decoration: BoxDecoration(
color: yellowColor color: primaryColor
), ),
// decoration: BoxDecoration( // decoration: BoxDecoration(
// image: DecorationImage( // image: DecorationImage(

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.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';
@ -53,7 +54,7 @@ class InputField extends StatefulWidget {
class _InputFieldState extends State<InputField> { class _InputFieldState extends State<InputField> {
late bool isPassword; late bool isPassword;
late bool isSearch; late bool isSearch;
double fieldHeight = 55; double fieldHeight = 45;
@override @override
void initState() { void initState() {
@ -79,7 +80,7 @@ class _InputFieldState extends State<InputField> {
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.h : fieldHeight),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
padding: fieldPadding, padding: fieldPadding,
decoration: decoration:
@ -88,7 +89,7 @@ class _InputFieldState extends State<InputField> {
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: TextFormField( child: TextFormField(
style: TextStyle( color: textColor ), style: TextStyle( color: textColor, fontSize: widget.smallVersion ? ScreenUtil().setSp(12) : ScreenUtil().setSp(15) ),
controller: widget.controller, controller: widget.controller,
keyboardType: widget.textInputType, keyboardType: widget.textInputType,
focusNode: widget.fieldFocusNode, focusNode: widget.fieldFocusNode,
@ -114,10 +115,10 @@ class _InputFieldState extends State<InputField> {
decoration: InputDecoration( decoration: InputDecoration(
hintText: widget.placeholder, hintText: widget.placeholder,
filled: true, filled: true,
fillColor: Colors.white, fillColor: whiteColor,
border: InputBorder.none, border: InputBorder.none,
hintStyle: hintStyle:
TextStyle(fontSize: widget.smallVersion ? 12 : 15, color: textColorLight)), TextStyle(fontSize: widget.smallVersion ? ScreenUtil().setSp(12) : ScreenUtil().setSp(15), color: placeholderColor)),
), ),
), ),
GestureDetector( GestureDetector(
@ -162,7 +163,7 @@ class _InputFieldState extends State<InputField> {
if (widget.validationMessage != null) if (widget.validationMessage != null)
NoteText( NoteText(
widget.validationMessage ?? '', widget.validationMessage ?? '',
color: Colors.red, color: dangerColor,
), ),
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 ?? ''),

View File

@ -16,7 +16,7 @@ class NoteText extends StatelessWidget {
style: TextStyle( style: TextStyle(
fontSize: fontSize ?? 12, fontSize: fontSize ?? 12,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
color: color ?? dayColor, color: color ?? placeholderColor,
), ),
); );
} }

29
lib/widgets/ui/logo.dart Normal file
View File

@ -0,0 +1,29 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class LogoSatu extends StatelessWidget {
const LogoSatu({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(50.0.sp),
child: SizedBox(
width: 185.w,
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 75.h,
child: Image.asset('assets/images/logo.png'),
),
AutoSizeText('Товароучетная система', style: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w400 ), )
],
),
),
);
}
}