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 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 {
compileSdkVersion 28
@ -46,11 +54,17 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}

View File

@ -5,10 +5,12 @@
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
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="io.flutter.app.FlutterApplication"
android:label="aman_kassa_flutter"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
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
import 'package:aman_kassa_flutter/shared/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
//service & tools
import 'core/locator.dart';
@ -27,9 +29,13 @@ class MainApplication extends StatelessWidget {
providers: ProviderInjector.providers.toList(),
child: MaterialApp(
theme: ThemeData(
//primaryColor: blueColor,
backgroundColor: Colors.white,
backgroundColor: backgroundColor,
primaryColor: primaryColor,
accentColor: yellowColor,
scaffoldBackgroundColor: Colors.white,
textTheme: GoogleFonts.latoTextTheme(
Theme.of(context).textTheme,
)
),
debugShowCheckedModeBanner: false,
builder: (context, child) => Navigator(

View File

@ -1,14 +1,38 @@
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 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 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 dayColor = Color.fromRGBO(52, 72, 94, 0.536);
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);
// Text Variables
const TextStyle buttonTitleTextStyle =
const TextStyle(fontWeight: FontWeight.w400, color: whiteColor, fontSize: 15);
const TextStyle buttonTitleTextStyle = 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(fontWeight: FontWeight.w700, color: textColor, fontSize: 15);

View File

@ -1,12 +1,35 @@
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:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
import 'package:stacked/stacked.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
Widget build(BuildContext context) {
return ViewModelBuilder<HomeViewModel>.reactive(
@ -15,10 +38,39 @@ class HomeView extends StatelessWidget {
navigationService: Provider.of(context)),
onModelReady: (viewModel) {
viewModel.initialize();
viewModel.pageController = new PageController(initialPage: viewModel.tabIndex);
viewModel.pageController =
new PageController(initialPage: viewModel.tabIndex);
},
builder: (context, viewModel, child) {
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(
onPageChanged: (index) {
viewModel.tabIndex = index;
@ -26,26 +78,33 @@ class HomeView extends StatelessWidget {
controller: viewModel.pageController,
children: <Widget>[
KassaTab(viewModel, 0),
PrefencesTab(viewModel, 1)
CalculatorTab(viewModel, 1),
AdditionalTab(viewModel, 2)
],
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: viewModel.tabIndex,
backgroundColor: menuColor,
type: BottomNavigationBarType.shifting,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.add_shopping_cart,
color: Color.fromARGB(255, 0, 0, 0)),
backgroundColor: menuColor,
icon: Icon(Icons.add_shopping_cart, color: Colors.white),
title: new Text(
'Касса',
style: TextStyle(color: Colors.black),
style: TextStyle(color: Colors.white),
)),
BottomNavigationBarItem(
icon: Icon(Icons.assignment,
color: Color.fromARGB(255, 0, 0, 0)),
icon: Icon(Icons.cake, color: Colors.white),
title: new Text(
'Калькулятор',
style: TextStyle(color: Colors.white),
)),
BottomNavigationBarItem(
icon: Icon(Icons.assignment, color: Colors.white),
title: new Text(
'Опции',
style: TextStyle(color: Colors.black),
style: TextStyle(color: Colors.white),
)),
],
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;
}
@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;
import 'package:aman_kassa_flutter/shared/app_colors.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/input_field.dart';
@ -24,7 +25,11 @@ class LoginView extends StatelessWidget {
email: emailController.text.trim(),
password: passwordController.text);
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(),
)));
}
}
@ -39,7 +44,7 @@ class LoginView extends StatelessWidget {
builder: (context, viewModel, child) {
return Scaffold(
key: _scaffoldKey,
//backgroundColor: Colors.white,
backgroundColor: fillColor,
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 50),
child: Column(

View File

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

View File

@ -76,6 +76,13 @@ packages:
description: flutter
source: sdk
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:
dependency: "direct dev"
description: flutter

View File

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