Kassa tab

4.4
Serik.Uvaissov 2020-05-29 15:29:55 +06:00
parent 28bffdf0f7
commit 9fe2c71075
15 changed files with 342 additions and 120 deletions

View File

@ -25,6 +25,14 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android { android {
compileSdkVersion 28 compileSdkVersion 28
@ -46,11 +54,17 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes { buildTypes {
release { release {
// TODO: Add your own signing config for the release build. signingConfig signingConfigs.release
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
} }
} }
} }

View File

@ -5,10 +5,12 @@
In most cases you can leave this as-is, but you if you want to provide In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. --> FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET" />
<application <application
android:name="io.flutter.app.FlutterApplication" android:name="io.flutter.app.FlutterApplication"
android:label="aman_kassa_flutter" android:label="aman_kassa_flutter"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:launchMode="singleTop" android:launchMode="singleTop"

4
android/key.properties Normal file
View File

@ -0,0 +1,4 @@
storePassword=Uvai$$ov8928
keyPassword=Uvai$$ov8928
keyAlias=my-key-alias
storeFile=D:/Work/serik/Android/keystore/my-release-key.keystore

View File

@ -1,5 +1,7 @@
//general //general
import 'package:aman_kassa_flutter/shared/app_colors.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
//service & tools //service & tools
import 'core/locator.dart'; import 'core/locator.dart';
@ -27,9 +29,13 @@ class MainApplication extends StatelessWidget {
providers: ProviderInjector.providers.toList(), providers: ProviderInjector.providers.toList(),
child: MaterialApp( child: MaterialApp(
theme: ThemeData( theme: ThemeData(
//primaryColor: blueColor, backgroundColor: backgroundColor,
backgroundColor: Colors.white, primaryColor: primaryColor,
accentColor: yellowColor,
scaffoldBackgroundColor: Colors.white, scaffoldBackgroundColor: Colors.white,
textTheme: GoogleFonts.latoTextTheme(
Theme.of(context).textTheme,
)
), ),
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
builder: (context, child) => Navigator( builder: (context, child) => Navigator(

View File

@ -1,14 +1,38 @@
import 'package:flutter/material.dart'; 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 primaryColor = Color.fromRGBO(51, 122, 183, 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 yellowColor = Color.fromRGBO(250, 175, 0, 1);
const Color textColor = Color.fromRGBO(51, 51, 51, 1);
const Color shadowColor = Color.fromRGBO(80, 137, 196, 0.47); const Color shadowColor = Color.fromRGBO(80, 137, 196, 0.47);
const Color cardShadowColor = Color.fromRGBO(228, 229, 231, 0.25); const Color cardShadowColor = Color.fromRGBO(228, 229, 231, 0.25);
const Color blueColor = Color.fromRGBO(96, 205, 255, 1); const Color blueColor = Color.fromRGBO(96, 205, 255, 1);
const Color blueColorLigth = Color.fromRGBO(96, 205, 255, 0.536); const Color blueColorLigth = Color.fromRGBO(96, 205, 255, 0.536);
const Color redColor = Color.fromRGBO(255, 98, 96, 1);
const Color greenColor = Color.fromRGBO(59, 222, 134, 1);
const Color whiteColor = Color.fromRGBO(255, 255, 255, 1);
const Color textColor = Color.fromRGBO(107, 120, 151, 1);
const Color textColorLight = Color.fromRGBO(162, 171, 191, 1); const Color textColorLight = Color.fromRGBO(162, 171, 191, 1);
const Color dayColor = Color.fromRGBO(52, 72, 94, 0.536); const Color dayColor = Color.fromRGBO(52, 72, 94, 0.536);
const Color dayColorLight = Color.fromRGBO(255, 228, 231, 1); const Color dayColorLight = Color.fromRGBO(255, 228, 231, 1);
const Color backgroundColor = Color.fromRGBO(249, 250, 254, 1);

View File

@ -20,8 +20,9 @@ const EdgeInsets largeFieldPadding =
const EdgeInsets.symmetric(horizontal: 15, vertical: 15); const EdgeInsets.symmetric(horizontal: 15, vertical: 15);
// Text Variables // Text Variables
const TextStyle buttonTitleTextStyle = const TextStyle buttonTitleTextStyle = const TextStyle(fontWeight: FontWeight.w400, color: whiteColor, fontSize: 15);
const TextStyle(fontWeight: FontWeight.w400, color: whiteColor, fontSize: 15);
const TextStyle buttonBigTitleTextStyle = const TextStyle(fontWeight: FontWeight.w400, color: whiteColor, fontSize: 22, );
const TextStyle stepTitleTextStyle = const TextStyle stepTitleTextStyle =
const TextStyle(fontWeight: FontWeight.w700, color: textColor, fontSize: 15); const TextStyle(fontWeight: FontWeight.w700, color: textColor, fontSize: 15);

View File

@ -1,12 +1,35 @@
library home_view; library home_view;
import 'package:aman_kassa_flutter/shared/app_colors.dart';
import 'package:aman_kassa_flutter/shared/shared_styles.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
import 'home_view_model.dart'; import 'home_view_model.dart';
class HomeView extends StatelessWidget { part './tabs/KassaTab.dart';
part './tabs/CalculatorTab.dart';
part './tabs/AdditionalTab.dart';
class Choice {
const Choice({this.title, this.icon});
final String title;
final IconData icon;
}
const List<Choice> choices = const <Choice>[
const Choice(title: 'Обновить номенклатуру', icon: Icons.directions_car),
const Choice(title: 'Помощь', icon: Icons.directions_car),
const Choice(title: 'О Программе', icon: Icons.directions_car),
const Choice(title: 'Язык', icon: Icons.directions_car),
const Choice(title: 'Выйти', icon: Icons.directions_bike)
];
class HomeView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ViewModelBuilder<HomeViewModel>.reactive( return ViewModelBuilder<HomeViewModel>.reactive(
@ -15,10 +38,39 @@ class HomeView extends StatelessWidget {
navigationService: Provider.of(context)), navigationService: Provider.of(context)),
onModelReady: (viewModel) { onModelReady: (viewModel) {
viewModel.initialize(); viewModel.initialize();
viewModel.pageController = new PageController(initialPage: viewModel.tabIndex); viewModel.pageController =
new PageController(initialPage: viewModel.tabIndex);
}, },
builder: (context, viewModel, child) { builder: (context, viewModel, child) {
return Scaffold( return Scaffold(
appBar: AppBar(
title: Center(
child: Container(
width: 100,
child: Image(
image: AssetImage('assets/images/logo.png'),
fit: BoxFit.fitHeight,
),
)),
actions: <Widget>[
PopupMenuButton<Choice>(
icon: Icon(
Icons.more_vert,
color: menuColor,
),
onSelected: (s) {},
itemBuilder: (BuildContext context) {
return choices.map((Choice choice) {
return PopupMenuItem<Choice>(
value: choice,
child: Text(choice.title),
);
}).toList();
},
)
],
backgroundColor: fillColor,
),
body: PageView( body: PageView(
onPageChanged: (index) { onPageChanged: (index) {
viewModel.tabIndex = index; viewModel.tabIndex = index;
@ -26,26 +78,33 @@ class HomeView extends StatelessWidget {
controller: viewModel.pageController, controller: viewModel.pageController,
children: <Widget>[ children: <Widget>[
KassaTab(viewModel, 0), KassaTab(viewModel, 0),
PrefencesTab(viewModel, 1) CalculatorTab(viewModel, 1),
AdditionalTab(viewModel, 2)
], ],
), ),
bottomNavigationBar: BottomNavigationBar( bottomNavigationBar: BottomNavigationBar(
currentIndex: viewModel.tabIndex, currentIndex: viewModel.tabIndex,
backgroundColor: menuColor,
type: BottomNavigationBarType.shifting, type: BottomNavigationBarType.shifting,
items: [ items: [
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Icons.add_shopping_cart, backgroundColor: menuColor,
color: Color.fromARGB(255, 0, 0, 0)), icon: Icon(Icons.add_shopping_cart, color: Colors.white),
title: new Text( title: new Text(
'Касса', 'Касса',
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.white),
)), )),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon(Icons.assignment, icon: Icon(Icons.cake, color: Colors.white),
color: Color.fromARGB(255, 0, 0, 0)), title: new Text(
'Калькулятор',
style: TextStyle(color: Colors.white),
)),
BottomNavigationBarItem(
icon: Icon(Icons.assignment, color: Colors.white),
title: new Text( title: new Text(
'Опции', 'Опции',
style: TextStyle(color: Colors.black), style: TextStyle(color: Colors.white),
)), )),
], ],
onTap: (index) { onTap: (index) {
@ -60,51 +119,3 @@ class HomeView extends StatelessWidget {
}); });
} }
} }
class KassaTab extends StatelessWidget {
final HomeViewModel viewModel;
final int index;
KassaTab(this.viewModel, this.index);
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
body: Column(
children: <Widget>[
Text('KassaTab index:$index ${viewModel.currentUser.fullName} ')
],
),
floatingActionButton: viewModel.tabIndex == 0
? FloatingActionButton(
onPressed: () {},
child: Icon(
Icons.add,
color: Colors.black,
size: 45,
),
backgroundColor: Colors.white,
)
: null);
}
}
class PrefencesTab extends StatelessWidget {
final HomeViewModel viewModel;
final int index;
PrefencesTab(this.viewModel, this.index);
@override
Widget build(BuildContext context) {
// TODO: implement build
return Container(
child: Column(
children: <Widget>[
Text('PrefencesTab index:$index ${viewModel.currentUser.fullName} ')
],
),
);
}
}

View File

@ -38,5 +38,11 @@ class HomeViewModel extends BaseViewModel {
_currentUser = _authenticationService.currentUser; _currentUser = _authenticationService.currentUser;
} }
@override
void dispose() {
// TODO: implement dispose
super.dispose();
_pageController.dispose();
}
} }

View File

@ -0,0 +1,20 @@
part of home_view;
class AdditionalTab extends StatelessWidget {
final HomeViewModel viewModel;
final int index;
AdditionalTab(this.viewModel, this.index);
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: <Widget>[
Text('AdditionalTab index:$index ${viewModel.currentUser.fullName} ',
style: GoogleFonts.lato(color: Colors.black87))
],
),
);
}
}

View File

@ -0,0 +1,21 @@
part of home_view;
class CalculatorTab extends StatelessWidget {
final HomeViewModel viewModel;
final int index;
CalculatorTab(this.viewModel, this.index);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
children: <Widget>[
Text('CalculatorTab index:$index ${viewModel.currentUser.fullName} ',
style: TextStyle(color: Colors.black87))
],
),
));
}
}

View File

@ -0,0 +1,100 @@
part of home_view;
List<String> litems = ["1","2","3","4","1","2","3","4","1","2","3","4","1","2","3","4","1","2","3","4","1","2","3","4","1","2","3","4","1","2","3","4"];
class KassaTab extends StatelessWidget {
final HomeViewModel viewModel;
final int index;
KassaTab(this.viewModel, this.index);
Widget buildBody(BuildContext ctxt, int index) {
return new Text(litems[index]);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: EdgeInsets.all(4),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: RaisedButton(
padding: EdgeInsets.all(8),
color: primaryColor,
child: Text(
"Добавить",
style: buttonBigTitleTextStyle,
),
onPressed: () => null,
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: RaisedButton(
padding: EdgeInsets.all(8),
color: greenColor,
child: Text(
"Каталог",
style: buttonBigTitleTextStyle,
),
onPressed: () => null,
),
),
),
],
),
Expanded(
child: Container(
child: ListView.builder
(
itemCount: litems.length,
itemBuilder: (BuildContext ctxt, int index) => buildBody(ctxt, index)
),
),
),
Row(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: RaisedButton(
padding: EdgeInsets.all(8),
color: redColor,
child: Text(
"Возврат",
style: buttonBigTitleTextStyle,
),
onPressed: () => null,
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(4.0),
child: RaisedButton(
padding: EdgeInsets.all(8),
color: greenColor,
child: Text(
"Оплата",
style: buttonBigTitleTextStyle,
),
onPressed: () => null,
),
),
),
],
)
],
),
),
);
}
}

View File

@ -1,5 +1,6 @@
library login_view; library login_view;
import 'package:aman_kassa_flutter/shared/app_colors.dart';
import 'package:aman_kassa_flutter/shared/ui_helpers.dart'; import 'package:aman_kassa_flutter/shared/ui_helpers.dart';
import 'package:aman_kassa_flutter/widgets/fields/busy_button.dart'; import 'package:aman_kassa_flutter/widgets/fields/busy_button.dart';
import 'package:aman_kassa_flutter/widgets/fields/input_field.dart'; import 'package:aman_kassa_flutter/widgets/fields/input_field.dart';
@ -23,9 +24,13 @@ class LoginView extends StatelessWidget {
String message = await viewModel.login( String message = await viewModel.login(
email: emailController.text.trim(), email: emailController.text.trim(),
password: passwordController.text); password: passwordController.text);
if(message!=null) { if (message != null) {
_scaffoldKey.currentState.showSnackBar(new SnackBar(content: new Text(message, style: GoogleFonts.lato(),))); _scaffoldKey.currentState.showSnackBar(new SnackBar(
} content: new Text(
message,
style: GoogleFonts.lato(),
)));
}
} }
//LoginViewModel viewModel = LoginViewModel(); //LoginViewModel viewModel = LoginViewModel();
@ -38,56 +43,56 @@ class LoginView extends StatelessWidget {
}, },
builder: (context, viewModel, child) { builder: (context, viewModel, child) {
return Scaffold( return Scaffold(
key: _scaffoldKey, key: _scaffoldKey,
//backgroundColor: Colors.white, backgroundColor: fillColor,
body: Padding( body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 50), padding: const EdgeInsets.symmetric(horizontal: 50),
child: Column( child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 150,
child: Image.asset('assets/images/logo.png'),
//child: FlutterLogo(size: 120,),
),
InputField(
placeholder: 'Электронная почта',
controller: emailController,
textInputType: TextInputType.emailAddress,
nextFocusNode: passwordNode,
additionalNote: viewModel.messageEmail,
),
verticalSpaceSmall,
InputField(
placeholder: 'Пароль',
password: true,
controller: passwordController,
fieldFocusNode: passwordNode,
additionalNote: viewModel.messagePassword,
enterPressed: () => login(viewModel),
),
verticalSpaceMedium,
Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.center,
children: [ crossAxisAlignment: CrossAxisAlignment.center,
BusyButton( children: <Widget>[
title: 'Войти', SizedBox(
busy: viewModel.busy, height: 150,
onPressed: () => login(viewModel), child: Image.asset('assets/images/logo.png'),
//child: FlutterLogo(size: 120,),
),
InputField(
placeholder: 'Электронная почта',
controller: emailController,
textInputType: TextInputType.emailAddress,
nextFocusNode: passwordNode,
additionalNote: viewModel.messageEmail,
),
verticalSpaceSmall,
InputField(
placeholder: 'Пароль',
password: true,
controller: passwordController,
fieldFocusNode: passwordNode,
additionalNote: viewModel.messagePassword,
enterPressed: () => login(viewModel),
),
verticalSpaceMedium,
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: [
BusyButton(
title: 'Войти',
busy: viewModel.busy,
onPressed: () => login(viewModel),
)
],
),
verticalSpaceLarge,
TextLink(
'Регистрация',
onPressed: () {},
) )
], ],
), ),
verticalSpaceLarge, ));
TextLink(
'Регистрация',
onPressed: () {},
)
],
),
));
}); });
} }
} }

View File

@ -33,11 +33,11 @@ class _BusyButtonState extends State<BusyButton> {
horizontal: widget.busy ? 10 : 25, horizontal: widget.busy ? 10 : 25,
vertical: widget.busy ? 10 : 15), vertical: widget.busy ? 10 : 15),
decoration: BoxDecoration( decoration: BoxDecoration(
color: widget.enabled ? blueColor : blueColorLigth, color: widget.enabled ? primaryColor : blueColorLigth,
borderRadius: BorderRadius.circular(7), borderRadius: BorderRadius.circular(7),
boxShadow: [mainShadowBox] boxShadow: [mainShadowBox]
), ),
child: !widget.busy child: !widget.busy
? Text( ? Text(
widget.title, widget.title,
style: buttonTitleTextStyle, style: buttonTitleTextStyle,

View File

@ -76,6 +76,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_boom_menu:
dependency: "direct main"
description:
name: flutter_boom_menu
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter

View File

@ -16,6 +16,7 @@ dependencies:
equatable: ^1.1.1 equatable: ^1.1.1
http: ^0.12.1 http: ^0.12.1
google_fonts: ^1.1.0 google_fonts: ^1.1.0
flutter_boom_menu: ^1.0.2
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter