add packages, receiving & processing

This commit is contained in:
Sai Naw Wun
2020-10-12 03:34:05 +06:30
parent 32e6be2abd
commit b13dc69161
36 changed files with 1110 additions and 668 deletions

View File

@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
Widget badgeCounter(Widget child, int counter) {
return Container(
width: 120,
height: 140,
child: new Stack(
children: <Widget>[
child,

View File

@@ -0,0 +1,120 @@
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:flutter/material.dart';
import 'local_popupmenu.dart';
typedef PopupMenuCallback = Function(LocalPopupMenu popupMenu);
class LocalPopupMenuButton extends StatefulWidget {
final PopupMenuCallback popupMenuCallback;
final List<LocalPopupMenu> popmenus;
final bool multiSelect;
const LocalPopupMenuButton(
{Key key,
this.popupMenuCallback,
this.popmenus,
this.multiSelect = false})
: super(key: key);
@override
_LocalPopupMenuButtonState createState() => _LocalPopupMenuButtonState();
}
class _LocalPopupMenuButtonState extends State<LocalPopupMenuButton> {
List<LocalPopupMenu> popmenus;
@override
void initState() {
popmenus = widget.popmenus;
super.initState();
}
@override
Widget build(BuildContext context) {
bool hightlight = _needHighlight();
return PopupMenuButton<LocalPopupMenu>(
elevation: 3.2,
onSelected: (selected) {
if (!widget.multiSelect) {
setState(() {
popmenus.forEach((e) {
if (e.id != selected.id)
e.selected = false;
else
e.selected = true;
});
});
selected.selected = true;
} else {
setState(() {
popmenus.forEach((e) {
if (e.id == selected.id) e.selected = !e.selected;
});
});
selected.selected = !selected.selected;
}
if (widget.popupMenuCallback != null)
widget.popupMenuCallback(selected);
},
icon: Container(
width: 30,
height: 30,
decoration: new BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
),
child: Stack(
fit: StackFit.expand,
children: <Widget>[
Icon(
Icons.filter_list,
color: primaryColor,
),
hightlight
? Positioned(
bottom: 0,
right: 0,
child: Container(
width: 10,
height: 10,
decoration: new BoxDecoration(
shape: BoxShape.circle,
color: secondaryColor,
),
),
)
: Container()
],
)),
itemBuilder: (BuildContext context) {
return popmenus.map((LocalPopupMenu choice) {
return PopupMenuItem<LocalPopupMenu>(
value: choice,
child: Row(
children: <Widget>[
LocalText(context, choice.textKey, color: primaryColor),
SizedBox(
width: 10,
),
choice.selected
? Icon(
Icons.check,
color: Colors.grey,
)
: Container(),
],
),
);
}).toList();
});
}
bool _needHighlight() {
popmenus.forEach((e) {
if (e.selected && e.highlight) return true;
});
return false;
}
}

View File

@@ -0,0 +1,8 @@
class LocalPopupMenu {
int id;
String textKey;
bool selected;
bool highlight;
LocalPopupMenu(
{this.id, this.textKey, this.selected = false, this.highlight = false});
}

View File

@@ -1,5 +1,3 @@
import 'package:flutter/material.dart';
class PopupMenu {
int id;
String status;

View File

@@ -19,10 +19,19 @@ class StatusTree extends StatelessWidget {
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(left: 20),
height: 400,
child: Timeline(children: _models(), position: TimelinePosition.Left),
return ExpansionTile(
initiallyExpanded: true,
title: Text(
'Status',
style: TextStyle(color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 20),
height: 400,
child: Timeline(children: _models(), position: TimelinePosition.Left),
)
],
);
}

View File

@@ -1,3 +1,4 @@
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/main/model/language_model.dart';
import 'package:flutter/material.dart';
@@ -22,7 +23,7 @@ class TaskButton extends StatelessWidget {
onTap: btnCallback != null ? btnCallback : () => {},
child: Container(
width: 120,
height: 170,
height: 155,
padding: EdgeInsets.only(top: 0.0, left: 5, right: 5),
decoration: new BoxDecoration(
color: Colors.transparent,
@@ -42,7 +43,7 @@ class TaskButton extends StatelessWidget {
),
),
Container(
height: 60,
height: 45,
alignment: Alignment.topCenter,
child: Text(AppTranslations.of(context).text(titleKey),
textAlign: TextAlign.center,