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,10 +49,11 @@ Future<void> auth(Store<AppState> store) async {
store.dispatch(SetUserStateAction(UserState(isLoading: true)));
try {
UserState? state = store.state.userState;
if(state!.auth!.operation == false) {
if(state != null) {
if (state.auth?.operation == false) {
_navigation.replace(LoginViewRoute);
} else {
AuthResponse response = await _api.auth(state.auth!.token!);
AuthResponse response = await _api.auth(state.auth?.token ?? '');
if (response.operation!) {
_api.token = response.token!;
_navigation.replace(MainViewRoute);
@ -61,6 +62,9 @@ Future<void> auth(Store<AppState> store) async {
_navigation.replace(LoginViewRoute);
}
}
} else {
_navigation.replace(LoginViewRoute);
}
} catch (e) {
print(e);
} finally {

View File

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

View File

@ -1,38 +1,22 @@
import 'package:flutter/material.dart';
const Color backgroundColor = Color.fromRGBO(255, 255, 255, 1);
// const Color fillColor = Color.fromRGBO(248, 248, 248, 1);
const Color fillColor = Color.fromRGBO(252, 252, 252, 1);
const Color primaryColor = Color.fromRGBO(51, 122, 183, 1);
const Color backgroundColor = Color.fromRGBO(235, 239, 248, 1);
const Color primaryColor = Color.fromRGBO(255, 196, 45, 1);
const Color halykColor = Color.fromRGBO(0, 118, 59, 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 dangerColor = Color.fromRGBO(243, 98, 88, 1);
const Color successColor = Color.fromRGBO(39, 174, 96, 1);
const Color whiteColor = Color.fromRGBO(255, 255, 255, 1);
const Color blackColor = Color.fromRGBO(0, 0, 0, 1);
const Color yellowColor = Color.fromRGBO(250, 175, 0, 1);
const Color blackColor = Color.fromRGBO(35, 35, 35, 1);
const Color purpleColor = Color.fromRGBO(118, 122, 230, 1);
const Color purpleSecondColor = Color.fromRGBO(140, 143, 236, 1);
const Color textColor = Color.fromRGBO(51, 51, 51, 1);
const Color shadowColor = Color.fromRGBO(72, 72, 72, 0.25);
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 cardShadowColor = Color.fromRGBO(228, 229, 231, 0.25);
const Color blueColor = Color.fromRGBO(96, 205, 255, 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);
const Color textColor = Color.fromRGBO(69, 69, 69, 1);
const Color placeholderColor = Color.fromRGBO( 153, 153, 153, 1);
const Color disableColor = Color.fromRGBO( 221, 221, 221, 1);

View File

@ -1,18 +1,23 @@
import 'package:flutter/material.dart';
import 'app_colors.dart';
// Box Decorations
BoxDecoration fieldDecoration =
BoxDecoration(borderRadius: BorderRadius.circular(5) , color: Colors.white);
BoxDecoration fieldDecoration = BoxDecoration(color: whiteColor);
BoxDecoration disabledFieldDecoration = BoxDecoration(
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 smallFieldHeight = 40;
const double inputFieldBottomMargin = 30;
@ -22,26 +27,14 @@ const EdgeInsets largeFieldPadding =
const EdgeInsets.symmetric(horizontal: 15, vertical: 15);
// 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 =
TextStyle(color: Colors.black54, fontWeight: FontWeight.bold, fontSize: 24);
// Box Shadow
const BoxShadow mainShadowBox =
BoxShadow(blurRadius: 16, color: shadowColor, offset: Offset(0, 5));
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 =
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

@ -93,8 +93,10 @@ class _AddProductViewState extends State<AddProductView> {
isOdd: index % 2 == 0,
name: good.name,
price: good.price,
categoryName: _history?.last?.name!,
onPress: () => onGoodPress(good),
categoryName: _history?.last?.name,
onPress: () {
onGoodPress(good);
} ,
);
},
),
@ -119,12 +121,12 @@ class _AddProductViewState extends State<AddProductView> {
List<Widget> actions() {
return [
if(_history!.length > 1)
FlatButton(onPressed: () {
TextButton(onPressed: () {
_history!.removeLast();
navigateCategory(_history!.last.id!);
}, 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) {
return Card(
child: ListTile(
onTap: () => onPress,
onTap: () => onPress!(),
contentPadding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
title: Padding(
padding: const EdgeInsets.only(top: 4.0),
@ -24,17 +24,18 @@ class AddCategoryListItem extends StatelessWidget {
child: Center(
child: Text(
name!,
style: productTextStyle,
style: TextStyle(
fontWeight: FontWeight.w600, color: Colors.black, fontSize: 15),
overflow: TextOverflow.ellipsis,
maxLines: 3,
),
)
),
),
tileColor: !isOdd! ? fillColor : backgroundColor,
tileColor: !isOdd! ? whiteColor : backgroundColor,
trailing: Icon(
Icons.arrow_right,
color: yellowColor,
color: primaryColor,
),
),
);

View File

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

View File

@ -13,7 +13,8 @@ class BuyView extends StatelessWidget {
body: Center(
child: Text(
'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/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/core/services/navigator_service.dart';
@ -43,12 +44,11 @@ class _ProductListItemState extends State<ProductListItem> {
return Dismissible(
background: Container(
alignment: AlignmentDirectional.centerEnd,
color: redColor,
color: dangerColor,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Удалить',
style: buttonTitleTextStyle,
),
),
),
@ -61,8 +61,8 @@ class _ProductListItemState extends State<ProductListItem> {
title: const Text("Внимание"),
content: Text("Удалить товар \"${this.widget.name}\" - ${widget.count} ед. ?"),
actions: <Widget>[
FlatButton(onPressed: () => Navigator.of(context).pop(true), child: const Text("Удалить")),
FlatButton(
TextButton(onPressed: () => Navigator.of(context).pop(true), child: const Text("Удалить")),
TextButton(
onPressed: () => Navigator.of(context).pop(false),
child: const Text("Отмена"),
),
@ -77,57 +77,113 @@ class _ProductListItemState extends State<ProductListItem> {
},
key: Key(widget.name ?? ''),
child: ListTile(
onTap: () => _onItemTapped(context),
//onTap: () => _onItemTapped(context),
contentPadding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0),
title: Padding(
padding: const EdgeInsets.only(top: 4.0),
child: Row(
title: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
flex: 3,
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.name ?? '',
style: const TextStyle(fontWeight: FontWeight.w500),
style: TextStyle(fontSize: 12.sp, color: textColor),
overflow: TextOverflow.ellipsis,
maxLines: 2,
),
verticalSpaceTiny,
Text(
'Штрих-код: ${widget.ean}',
style: productSubTextStyle,
style: TextStyle(color: placeholderColor, fontSize: 8.sp),
),
if (widget.categoryName != null)
Text(
widget.categoryName ?? '',
style: productSubTextStyle,
'Категория: ${widget.categoryName}',
style: TextStyle(color: placeholderColor, fontSize: 8.sp),
)
],
),
),
Flexible(
flex: 1,
SizedBox(
width: 100.w,
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
Padding(
padding: const EdgeInsets.only(bottom: 3.0),
child: Text(
'${widget.price}',
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
style: TextStyle(fontSize: 12.sp, fontWeight: FontWeight.w500, color: textColor),
),
Text(
),
Row(
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: const TextStyle(fontSize: 12),
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,31 +12,56 @@ class ProductsAppBar extends StatelessWidget implements PreferredSizeWidget {
final double elevation;
final Color? backgroundColor;
const ProductsAppBar({Key? key, this.title, this.actions, this.child,this.childHeight = 0, this.elevation = 0.0, this.backgroundColor = Colors.transparent }) : super(key: key);
const ProductsAppBar(
{Key? key,
this.title,
this.actions,
this.child,
this.childHeight = 0,
this.elevation = 0.0,
this.backgroundColor = Colors.transparent})
: super(key: key);
@override
Widget build(BuildContext context) {
return Material(
elevation: elevation,
color: backgroundColor,
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/top_bar_bg.png'),
fit: BoxFit.fitWidth,
alignment: FractionalOffset.topLeft,
),
),
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: yellowColor,),
icon: Icon(
Icons.menu,
color: blackColor,
),
onPressed: () {
locator<NavigatorService>().scaffoldDrawerKey.currentState!.openDrawer();
locator<NavigatorService>()
.scaffoldDrawerKey
.currentState!
.openDrawer();
},
),
actions: actions
,
actions: actions,
),
if(child !=null && childHeight! > 0)
child!,
if (child != null && childHeight! > 0) child!,
],
),
),
);
}

View File

@ -1,73 +1,36 @@
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 ProductHeaderBar extends StatelessWidget {
final int count;
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
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(
bottom: 16.00,
left: 8.0,
right: 8.0,
),
padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.w),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Контрагент: Частное лицо',
style: productTextStyle,
'Итого: $sum тнг',
style: TextStyle(
fontWeight: FontWeight.w700,
color: blackColor,
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(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Всего: $count наим.',
style: productTextStyle,
),
Text('Итого: $sum тнг', style: productTextStyle),
],
'Товаров выбрано: $count',
style: TextStyle(
fontWeight: FontWeight.w400,
color: blackColor,
fontSize: ScreenUtil().setSp(15)),
),
],
),

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/products_app_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 'component/contagent_select_bar.dart';
class SellView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return StoreConnector<AppState, SellState>(
@ -27,16 +28,21 @@ class SellView extends StatelessWidget {
return Scaffold(
appBar: ProductsAppBar(
title: 'Продажа',
actions: actions(),
elevation: 2.0,
child: ProductHeaderBar(
count: state.items!.length,
sum: sumProducts(state.items!),
),
backgroundColor: backgroundColor,
childHeight: 80,
childHeight: 60,
),
body: ListView.builder(
body: Column(
children: [
ContragentSelectBar(
value: 'Частное лицо',
),
ProductsTitleBarBar(itemsExist: state.items!.isNotEmpty),
ListView.builder(
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemCount: state.items!.length,
itemBuilder: (BuildContext context, int index) {
@ -53,6 +59,8 @@ class SellView extends StatelessWidget {
);
},
),
],
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: floatingActionButtonRender(),
);
@ -64,7 +72,7 @@ class SellView extends StatelessWidget {
converter: (store) => store.state.sellState!,
builder: (_, snapshot) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 16.0),
padding: EdgeInsets.all(15.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
@ -73,14 +81,9 @@ class SellView extends StatelessWidget {
visible: snapshot.items!.isNotEmpty,
child: FloatingActionButton(
elevation: 2,
backgroundColor: greenColor,
backgroundColor: successColor,
onPressed: () => print('check'),
child: Icon(
Icons.check,
color: whiteColor,
size: 30.sp
),
child: Icon(Icons.check, color: whiteColor, size: 35.sp),
)),
Column(
mainAxisAlignment: MainAxisAlignment.end,
@ -88,13 +91,17 @@ class SellView extends StatelessWidget {
FloatingActionButton(
elevation: 2,
onPressed: () => locator<NavigatorService>().push(AddProductViewRoute),
child: Icon(Icons.add, size: 30.sp,),
child: Icon(
Icons.add_rounded,
size: 45.sp,
color: whiteColor,
),
),
verticalSpaceMedium,
FloatingActionButton(
elevation: 2,
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,
unselectedItemColor: Colors.black54,
selectedItemColor: yellowColor,
selectedItemColor: primaryColor,
selectedLabelStyle: const TextStyle( fontWeight: FontWeight.w600 ),
backgroundColor: whiteColor,
elevation: 8.0,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@ class NoteText extends StatelessWidget {
style: TextStyle(
fontSize: fontSize ?? 12,
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 ), )
],
),
),
);
}
}