diff --git a/android/app/build.gradle b/android/app/build.gradle index a6d008f..44b44b4 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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 } } } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index d454ab6..c25a2fd 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -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. --> + + android:icon="@mipmap/ic_launcher" + android:usesCleartextTraffic="true"> Navigator( diff --git a/lib/shared/app_colors.dart b/lib/shared/app_colors.dart index 76ee04f..060bd65 100644 --- a/lib/shared/app_colors.dart +++ b/lib/shared/app_colors.dart @@ -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); + + + + + + + + + + diff --git a/lib/shared/shared_styles.dart b/lib/shared/shared_styles.dart index 57f7a0e..2bbf659 100644 --- a/lib/shared/shared_styles.dart +++ b/lib/shared/shared_styles.dart @@ -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); diff --git a/lib/views/home/home_view.dart b/lib/views/home/home_view.dart index 1d920b6..31e1bc1 100644 --- a/lib/views/home/home_view.dart +++ b/lib/views/home/home_view.dart @@ -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 choices = const [ + 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.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: [ + PopupMenuButton( + icon: Icon( + Icons.more_vert, + color: menuColor, + ), + onSelected: (s) {}, + itemBuilder: (BuildContext context) { + return choices.map((Choice choice) { + return PopupMenuItem( + 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: [ 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: [ - 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: [ - Text('PrefencesTab index:$index ${viewModel.currentUser.fullName} ') - ], - ), - ); - } -} diff --git a/lib/views/home/home_view_model.dart b/lib/views/home/home_view_model.dart index ec6ed2a..daa6579 100644 --- a/lib/views/home/home_view_model.dart +++ b/lib/views/home/home_view_model.dart @@ -38,5 +38,11 @@ class HomeViewModel extends BaseViewModel { _currentUser = _authenticationService.currentUser; } + @override + void dispose() { + // TODO: implement dispose + super.dispose(); + _pageController.dispose(); + } } \ No newline at end of file diff --git a/lib/views/home/tabs/AdditionalTab.dart b/lib/views/home/tabs/AdditionalTab.dart new file mode 100644 index 0000000..70cdab8 --- /dev/null +++ b/lib/views/home/tabs/AdditionalTab.dart @@ -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: [ + Text('AdditionalTab index:$index ${viewModel.currentUser.fullName} ', + style: GoogleFonts.lato(color: Colors.black87)) + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/views/home/tabs/CalculatorTab.dart b/lib/views/home/tabs/CalculatorTab.dart new file mode 100644 index 0000000..502d44b --- /dev/null +++ b/lib/views/home/tabs/CalculatorTab.dart @@ -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: [ + Text('CalculatorTab index:$index ${viewModel.currentUser.fullName} ', + style: TextStyle(color: Colors.black87)) + ], + ), + )); + } +} \ No newline at end of file diff --git a/lib/views/home/tabs/KassaTab.dart b/lib/views/home/tabs/KassaTab.dart new file mode 100644 index 0000000..618d2f6 --- /dev/null +++ b/lib/views/home/tabs/KassaTab.dart @@ -0,0 +1,100 @@ +part of home_view; + +List 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: [ + Row( + children: [ + 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: [ + 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, + ), + ), + ), + ], + ) + ], + ), + ), + ); + } +} diff --git a/lib/views/login/login_view.dart b/lib/views/login/login_view.dart index fc80cb9..8b05d38 100644 --- a/lib/views/login/login_view.dart +++ b/lib/views/login/login_view.dart @@ -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'; @@ -23,9 +24,13 @@ class LoginView extends StatelessWidget { String message = await viewModel.login( email: emailController.text.trim(), password: passwordController.text); - if(message!=null) { - _scaffoldKey.currentState.showSnackBar(new SnackBar(content: new Text(message, style: GoogleFonts.lato(),))); - } + if (message != null) { + _scaffoldKey.currentState.showSnackBar(new SnackBar( + content: new Text( + message, + style: GoogleFonts.lato(), + ))); + } } //LoginViewModel viewModel = LoginViewModel(); @@ -38,56 +43,56 @@ class LoginView extends StatelessWidget { }, builder: (context, viewModel, child) { return Scaffold( - key: _scaffoldKey, - //backgroundColor: Colors.white, + key: _scaffoldKey, + backgroundColor: fillColor, body: Padding( - padding: const EdgeInsets.symmetric(horizontal: 50), - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - 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( + padding: const EdgeInsets.symmetric(horizontal: 50), + child: Column( mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - BusyButton( - title: 'Войти', - busy: viewModel.busy, - onPressed: () => login(viewModel), + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 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, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + BusyButton( + title: 'Войти', + busy: viewModel.busy, + onPressed: () => login(viewModel), + ) + ], + ), + verticalSpaceLarge, + TextLink( + 'Регистрация', + onPressed: () {}, ) ], ), - verticalSpaceLarge, - TextLink( - 'Регистрация', - onPressed: () {}, - ) - ], - ), - )); + )); }); } } diff --git a/lib/widgets/fields/busy_button.dart b/lib/widgets/fields/busy_button.dart index f5705d2..1c88d1e 100644 --- a/lib/widgets/fields/busy_button.dart +++ b/lib/widgets/fields/busy_button.dart @@ -33,11 +33,11 @@ class _BusyButtonState extends State { 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] ), - child: !widget.busy + child: !widget.busy ? Text( widget.title, style: buttonTitleTextStyle, diff --git a/pubspec.lock b/pubspec.lock index 31df060..a7c51d0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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 diff --git a/pubspec.yaml b/pubspec.yaml index 1a6dd00..007d90d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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