Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Thinzar Win
2020-05-29 16:22:13 +06:30
27 changed files with 1820 additions and 84 deletions

View File

@@ -4,6 +4,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
import 'package:logging/logging.dart';
import 'package:provider/provider.dart';
import 'dart:math' as math;
import 'package:fcs/charts/bar_chart.dart';
import 'package:fcs/charts/delivery_do_line.dart';
import 'package:fcs/charts/delivery_do_summary.dart';
@@ -12,30 +13,28 @@ import 'package:fcs/charts/delivery_summary.dart';
import 'package:fcs/charts/do_line.dart';
import 'package:fcs/charts/po_balance_chart.dart';
import 'package:fcs/charts/po_line.dart';
import 'package:fcs/charts/quota.dart';
import 'package:fcs/charts/revenue_line.dart';
import 'package:fcs/model/language_model.dart';
import 'package:fcs/model/main_model.dart';
import 'package:fcs/model/notification_model.dart';
import 'package:fcs/model/product_model.dart';
import 'package:fcs/pages/banks/banks.dart';
import 'package:fcs/pages/buyer_list.dart';
import 'package:fcs/pages/contact.dart';
import 'package:fcs/pages/delivery/delivery_list.dart';
import 'package:fcs/pages/manual/manual_page.dart';
import 'package:fcs/pages/my_registeration_info.dart';
import 'package:fcs/pages/notification_list.dart';
import 'package:fcs/pages/term.dart';
import 'package:fcs/pages/test_list.dart';
import 'package:fcs/pages/util.dart';
import 'package:fcs/reports/report_list.dart';
import 'package:fcs/vo/user.dart';
import 'package:fcs/widget/badge.dart';
import 'package:fcs/widget/banner.dart';
import 'package:fcs/widget/local_text.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:fcs/widget/offline_redirect.dart';
import 'package:fcs/vo/notification.dart' as Noti;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
import 'package:logging/logging.dart';
import 'package:provider/provider.dart';
import '../theme/theme.dart';
import 'announcement_list.dart';
@@ -48,6 +47,13 @@ import 'products_list.dart';
import 'profile_page.dart';
import 'signin_page.dart';
import 'staff_list.dart';
import 'fcs_profile_page.dart';
import 'pd/pd_list.dart';
import 'pickup_list.dart';
import 'products_list.dart';
import 'profile_page.dart';
import 'shipment_rates.dart';
import 'storage/storage_list.dart';
import 'user_list.dart';
@@ -85,7 +91,8 @@ class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
final helpBtn = _buildBtn("manual.title",
final helpBtn = _buildBtn2("manual.title",
icon: FontAwesomeIcons.readme,
imgIcon: Image.asset(
"assets/manual.png",
width: 40,
@@ -97,7 +104,7 @@ class _HomePageState extends State<HomePage> {
// btnCallback: () => Navigator.of(context)
// .push(MaterialPageRoute(builder: (_) => TestList()))
);
final announcementBtn = _buildBtn("announcement.title",
final announcementBtn = _buildBtn2("announcement.title",
icon: Icons.announcement,
btnCallback: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => AnnouncementList())));
@@ -112,7 +119,8 @@ class _HomePageState extends State<HomePage> {
btnCallback: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => BuyerList())));
final reportBtn = _buildBtn("report.title",
final reportBtn = _buildBtn2("report.title",
icon: FontAwesomeIcons.paperPlane,
imgIcon: Image.asset(
"assets/report.png",
width: 50,
@@ -122,6 +130,30 @@ class _HomePageState extends State<HomePage> {
btnCallback: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => ReportList())));
final pickUpBtn = _buildBtn("pickup.title",
icon: FontAwesomeIcons.directions,
btnCallback: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => PickUpList())));
final shipmentCostBtn = _buildBtn("pickup.title",
icon: FontAwesomeIcons.ship,
btnCallback: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => ShipmentRates())));
final fcsProfileBtn = _buildBtn("profile.title",
icon: Icons.account_circle,
btnCallback: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => FCSProfilePage())));
final myRegBtn = _buildBtn("myreg.title",
imgIcon: Image.asset(
"assets/reg.png",
width: 40,
height: 30,
color: primaryColor,
),
btnCallback: () async {});
final posBtn = _buildBtn("po.title",
imgIcon: Image.asset(
"assets/pay.png",
@@ -171,7 +203,9 @@ class _HomePageState extends State<HomePage> {
btnCallback: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => PDList())));
final termBtn = _buildBtn("term.title",
final termBtn = _buildBtn2("term.title",
icon: FontAwesomeIcons.fileContract,
imgIcon: Image.asset(
"assets/term.png",
width: 40,
@@ -220,7 +254,8 @@ class _HomePageState extends State<HomePage> {
btnCallback: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => StaffList())));
final _bankAccountsBtn = _buildBtn("banks.title",
final _bankAccountsBtn = _buildBtn2("banks.title",
icon: FontAwesomeIcons.moneyCheck, btnCallback: () {
Navigator.push(
context,
@@ -235,6 +270,13 @@ class _HomePageState extends State<HomePage> {
widgets.add(notiBtn);
widgets.add(staffBtn);
// widgets.add(_bankAccountsBtn);
widgets.add(announcementBtn);
widgets.add(pickUpBtn);
widgets.add(fcsProfileBtn);
widgets.add(shipmentCostBtn);
widgets.add(reportBtn);
widgets.add(termBtn);
widgets.add(_bankAccountsBtn);
var revenueChart = Padding(
padding: const EdgeInsets.all(10.0),
@@ -343,10 +385,11 @@ class _HomePageState extends State<HomePage> {
child: FlavorBanner(
child: Scaffold(
appBar: AppBar(
elevation: 0,
backgroundColor: primaryColor,
title: ClipRRect(
child: Image.asset("assets/logo.png", height: 40),
borderRadius: new BorderRadius.circular(15.0),
child: Image.asset("assets/logo.jpg", height: 40),
borderRadius: new BorderRadius.circular(35.0),
),
actions: <Widget>[
IconButton(
@@ -357,7 +400,7 @@ class _HomePageState extends State<HomePage> {
);
},
iconSize: 30,
icon: Icon(Icons.phone),
icon: Icon(Icons.notifications),
),
IconButton(
onPressed: () {
@@ -367,53 +410,99 @@ class _HomePageState extends State<HomePage> {
);
},
iconSize: 30,
icon: Icon(Icons.account_circle),
icon: Icon(Icons.tune),
),
]),
body: StaggeredGridView.count(
crossAxisCount: 3,
crossAxisSpacing: 12.0,
mainAxisSpacing: 12.0,
padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
children: <Widget>[
_buildTile(
Padding(
padding: const EdgeInsets.all(20.0),
child: productListBox,
),
onTap: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => ProductsList())),
),
new GridView.count(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
crossAxisCount: 1,
crossAxisSpacing: 12,
mainAxisSpacing: 12,
padding: EdgeInsets.only(bottom: 5, left: 10, right: 5),
children: widgets,
),
_buildTile(
PageView(
children: chartWidgets,
body: Container(
decoration: BoxDecoration(
gradient:
// RadialGradient(
// center: const Alignment(-0.7, 0.6), // near the top right
// radius: 0.6,
// colors: [
// secondaryColor,
// primaryColor, // yellow sun
// ],
// stops: [0.4, 1.0],
// )
// LinearGradient(
// begin: Alignment.topCenter,
// end: Alignment
// .bottomCenter, // 10% of the width, so there are ten blinds.
// colors: [
// Color(0xd0272262),
// Color(0xfa272262),
// ], // whitish to gray
// ),
SweepGradient(
center: FractionalOffset.centerLeft,
startAngle: 0.0,
endAngle: math.pi * 2,
colors: const <Color>[
secondaryColor,
primaryColor,
secondaryColor,
primaryColor,
secondaryColor,
],
stops: const <double>[0.0, 0.25, 0.5, 0.75, 1.0],
),
),
],
staggeredTiles: [
StaggeredTile.extent(5, 110.0),
StaggeredTile.extent(3, 110.0),
StaggeredTile.extent(3, 250.0),
],
)),
child: ListView(children: [
Wrap(
children: widgets,
),
])
// child: StaggeredGridView.count(
// crossAxisCount: 3,
// crossAxisSpacing: 12.0,
// mainAxisSpacing: 12.0,
// padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
// children: <Widget>[
// _buildTile(
// Padding(
// padding: const EdgeInsets.all(20.0),
// child: productListBox,
// ),
// onTap: () => Navigator.of(context).push(
// MaterialPageRoute(builder: (_) => ProductsList())),
// ),
// new GridView.count(
// shrinkWrap: true,
// scrollDirection: Axis.horizontal,
// crossAxisCount: 1,
// crossAxisSpacing: 12,
// mainAxisSpacing: 12,
// padding: EdgeInsets.only(bottom: 5, left: 10, right: 5),
// children: widgets,
// ),
// Container(
// color:Colors.red
// ),
// _buildTile(
// PageView(
// children: chartWidgets,
// ),
// ),
// ],
// staggeredTiles: [
// StaggeredTile.extent(5, 110.0),
// StaggeredTile.extent(3, 110.0),
// StaggeredTile.extent(3, 250.0),
// ],
// ),
)),
),
);
}
Widget _buildTile(Widget child, {Function() onTap}) {
return Material(
elevation: 30.0,
elevation: 0,
borderRadius: BorderRadius.circular(12.0),
shadowColor: Color(0x802196F3),
// shadowColor: Colors.transparent,
color: Colors.transparent,
child: InkWell(
onTap: onTap != null
? () => onTap()
@@ -460,12 +549,57 @@ class _HomePageState extends State<HomePage> {
);
}
_showNotifications() async {
if (!super.mounted) return;
await Navigator.push(
context,
MaterialPageRoute(builder: (context) => NotificationList()),
Widget _buildBtn2(String title,
{Image imgIcon, IconData icon, BtnCallback btnCallback}) {
var languageModel = Provider.of<LanguageModel>(context);
return Container(
width: 130,
height: 130,
decoration: new BoxDecoration(
color: Colors.transparent, //new Color.fromRGBO(255, 0, 0, 0.0),
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(40.0),
topRight: const Radius.circular(40.0))),
// color: Colors.transparent,
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
// Padding(
// padding: EdgeInsets.only(top: 10),
// child: Icon(icon, color: Colors.white, size: 35.0)),
// Padding(padding: EdgeInsets.only(bottom: 10.0)),
ClipOval(
child: Material(
color: Colors.white, // button color
child: InkWell(
splashColor: secondaryColor, // inkwell color
child: SizedBox(
width: 60, height: 60, child: Icon(icon, size: 35)),
onTap: btnCallback,
),
),
),
Text(AppTranslations.of(context).text(title),
style:
// languageModel.isEng
// ?
TextStyle(
color: Colors.white,
fontWeight: FontWeight.normal,
fontSize: 16.0,
fontFamily: "Roboto")
// : TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.w700,
// fontSize: 12.0,
// fontFamily: "MyanmarUnicode")
),
]),
),
);
// Provider.of<NotificationModel>(context, listen: false).seen();
}
}