|
@@ -106,43 +106,10 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
children: [
|
|
children: [
|
|
|
SizedBox(height: 16),
|
|
SizedBox(height: 16),
|
|
|
- Row(
|
|
|
|
|
- children: [
|
|
|
|
|
- GestureDetector(
|
|
|
|
|
- child: Container(
|
|
|
|
|
- margin: EdgeInsets.only(left: 16),
|
|
|
|
|
- padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
|
|
|
|
|
- decoration: BoxDecoration(
|
|
|
|
|
- color: Colors.white,
|
|
|
|
|
- border: Border(bottom: BorderSide(color: historyModuleListen.selectedFilter() == 1 ? primaryColor : primaryColor.withValues(alpha: 0.3), width: historyModuleListen.selectedFilter() == 1 ? 2 : 1))),
|
|
|
|
|
- child: Text('ongoing'.tr(), style: TextStyle(color: historyModuleListen.selectedFilter() == 1 ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
|
|
|
|
|
- ),
|
|
|
|
|
- onTap: () {
|
|
|
|
|
- if (!historyModule.isLoadHistory()) {
|
|
|
|
|
- historyModule.setPressAttention(0);
|
|
|
|
|
- historyModule.setSelectedFilter(1);
|
|
|
|
|
- historyFunction.onRefresh();
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- ),
|
|
|
|
|
- GestureDetector(
|
|
|
|
|
- child: Container(
|
|
|
|
|
- padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
|
|
|
|
|
- decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: historyModuleListen.selectedFilter() == 0 ? primaryColor : primaryColor.withValues(alpha: 0.3), width: historyModuleListen.selectedFilter() == 0 ? 2 : 1))),
|
|
|
|
|
- child: Text('done'.tr(), style: TextStyle(color: historyModuleListen.selectedFilter() == 0 ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
|
|
|
|
|
- ),
|
|
|
|
|
- onTap: () {
|
|
|
|
|
- if (!historyModule.isLoadHistory()) {
|
|
|
|
|
- historyModule.setPressAttention(0);
|
|
|
|
|
- historyModule.setSelectedFilter(0);
|
|
|
|
|
- historyFunction.onRefresh();
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- ),
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ buildTab(historyModuleListen),
|
|
|
SizedBox(height: 20),
|
|
SizedBox(height: 20),
|
|
|
- historyModuleListen.selectedFilter() == 0 ? doneFilter() : ongoingFilter(),
|
|
|
|
|
|
|
+ buildFilter(historyModuleListen),
|
|
|
|
|
+ // historyModuleListen.activeTab() == 0 ? doneFilter() : ongoingFilter(),
|
|
|
SizedBox(height: 20),
|
|
SizedBox(height: 20),
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
@@ -155,8 +122,8 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
|
|
|
scrollOffset: 500,
|
|
scrollOffset: 500,
|
|
|
child: EasyRefresh(
|
|
child: EasyRefresh(
|
|
|
header: MaterialHeader(clamping: true, color: primaryColor),
|
|
header: MaterialHeader(clamping: true, color: primaryColor),
|
|
|
- onRefresh: ()=>historyFunction.onRefresh(),
|
|
|
|
|
- child: historyModuleListen.selectedFilter() == 0 ? doneContainer() : ongoingContainer(),
|
|
|
|
|
|
|
+ onRefresh: () => historyFunction.onRefresh(),
|
|
|
|
|
+ child: historyModuleListen.activeTab().name == 'done' ? doneContainer() : ongoingContainer(),
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
) : userModuleListen.resetData() ? Container() : loadingTemplate(() {
|
|
) : userModuleListen.resetData() ? Container() : loadingTemplate(() {
|
|
@@ -168,29 +135,72 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Widget statusFilter(){
|
|
|
|
|
- final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
|
|
|
|
|
|
|
+ //# kodingan baru start
|
|
|
|
|
+ Widget buildTab(historyModuleListen){
|
|
|
|
|
+ HistoryTab activeTab = historyModuleListen.activeTab();
|
|
|
|
|
+
|
|
|
|
|
+ return Row(
|
|
|
|
|
+ children: [
|
|
|
|
|
+ GestureDetector(
|
|
|
|
|
+ child: Container(
|
|
|
|
|
+ margin: EdgeInsets.only(left: 16),
|
|
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
|
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
|
+ color: Colors.white,
|
|
|
|
|
+ border: Border(bottom: BorderSide(color: activeTab.name == "ongoing" ? primaryColor : primaryColor.withValues(alpha: 0.3), width: activeTab.name == "ongoing" ? 2 : 1))),
|
|
|
|
|
+ child: Text('ongoing'.tr(), style: TextStyle(color: activeTab.name == "ongoing" ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
|
|
|
|
|
+ ),
|
|
|
|
|
+ onTap: () {
|
|
|
|
|
+ if (!historyModule.isLoadHistory()) {
|
|
|
|
|
+ historyModule.setSelectedFilter('none');
|
|
|
|
|
+ historyModule.setActiveTab(HistoryTab.ongoing);
|
|
|
|
|
+ historyFunction.onRefresh();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ ),
|
|
|
|
|
+ GestureDetector(
|
|
|
|
|
+ child: Container(
|
|
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 5, horizontal: 16),
|
|
|
|
|
+ decoration: BoxDecoration(color: Colors.white, border: Border(bottom: BorderSide(color: activeTab.name == "done" ? primaryColor : primaryColor.withValues(alpha: 0.3), width: activeTab.name == "done" ? 2 : 1))),
|
|
|
|
|
+ child: Text('done'.tr(), style: TextStyle(color: activeTab.name == "done" ? textColor : textColor.withValues(alpha: 0.65), fontSize: 16)),
|
|
|
|
|
+ ),
|
|
|
|
|
+ onTap: () {
|
|
|
|
|
+ if (!historyModule.isLoadHistory()) {
|
|
|
|
|
+ historyModule.setSelectedFilter('none');
|
|
|
|
|
+ historyModule.setActiveTab(HistoryTab.done);
|
|
|
|
|
+ historyFunction.onRefresh();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ ),
|
|
|
|
|
+ ],
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Widget buildFilter(historyModuleListen){
|
|
|
|
|
+ HistoryTab tab = historyModuleListen.activeTab();
|
|
|
|
|
+ List currentFilters = tab.filters;
|
|
|
|
|
+
|
|
|
return SingleChildScrollView(
|
|
return SingleChildScrollView(
|
|
|
scrollDirection: Axis.horizontal,
|
|
scrollDirection: Axis.horizontal,
|
|
|
child: Row(
|
|
child: Row(
|
|
|
- children: List.generate(historyFunction.filterList.length, (i) {
|
|
|
|
|
|
|
+ children: List.generate(currentFilters.length, (i) {
|
|
|
return GestureDetector(
|
|
return GestureDetector(
|
|
|
child: Container(
|
|
child: Container(
|
|
|
margin: EdgeInsets.only(left: 16),
|
|
margin: EdgeInsets.only(left: 16),
|
|
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
|
decoration: BoxDecoration(
|
|
decoration: BoxDecoration(
|
|
|
- color: historyModuleListen.checkPressAttention(historyFunction.filterList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
|
|
|
|
|
- border: Border.all(color: historyModuleListen.checkPressAttention(historyFunction.filterList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
|
|
|
|
|
|
|
+ color: historyModuleListen.checkSelectedFilter(currentFilters[i]['value']) ? primaryColor : Color(0xffF2F8F7),
|
|
|
|
|
+ border: Border.all(color: historyModuleListen.checkSelectedFilter(currentFilters[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
|
|
|
borderRadius: BorderRadius.all(Radius.circular(50))),
|
|
borderRadius: BorderRadius.all(Radius.circular(50))),
|
|
|
- child: Text(historyFunction.filterList[i]['title'], style: TextStyle(color: historyModuleListen.checkPressAttention(historyFunction.ongoingList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
|
|
|
|
|
|
|
+ child: Text(currentFilters[i]['title'], style: TextStyle(color: historyModuleListen.checkSelectedFilter(currentFilters[i]['value']) ? Colors.white : textColor, fontSize: 16)),
|
|
|
),
|
|
),
|
|
|
onTap: () {
|
|
onTap: () {
|
|
|
if (!historyModule.isLoadHistory()) {
|
|
if (!historyModule.isLoadHistory()) {
|
|
|
- if (historyModule.checkPressAttention(historyFunction.filterList[i]['value'])) {
|
|
|
|
|
- historyModule.setPressAttention(0);
|
|
|
|
|
|
|
+ if (historyModule.checkSelectedFilter(currentFilters[i]['value'])) {
|
|
|
|
|
+ historyModule.setSelectedFilter('none');
|
|
|
historyFunction.onRefresh();
|
|
historyFunction.onRefresh();
|
|
|
} else {
|
|
} else {
|
|
|
- historyModule.setPressAttention(historyFunction.filterList[i]['value']);
|
|
|
|
|
|
|
+ historyModule.setSelectedFilter(currentFilters[i]['value']);
|
|
|
historyFunction.onRefresh();
|
|
historyFunction.onRefresh();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -200,6 +210,7 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
|
|
|
),
|
|
),
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
+ //# kodingan baru end
|
|
|
|
|
|
|
|
Widget ongoingFilter() {
|
|
Widget ongoingFilter() {
|
|
|
final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
|
|
final HistoryModule historyModuleListen = Provider.of<HistoryModule>(context);
|
|
@@ -212,18 +223,18 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
|
|
|
margin: EdgeInsets.only(left: 16),
|
|
margin: EdgeInsets.only(left: 16),
|
|
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
|
decoration: BoxDecoration(
|
|
decoration: BoxDecoration(
|
|
|
- color: historyModuleListen.checkPressAttention(historyFunction.ongoingList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
|
|
|
|
|
- border: Border.all(color: historyModuleListen.checkPressAttention(historyFunction.ongoingList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
|
|
|
|
|
|
|
+ color: historyModuleListen.checkSelectedFilter(historyFunction.ongoingList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
|
|
|
|
|
+ border: Border.all(color: historyModuleListen.checkSelectedFilter(historyFunction.ongoingList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
|
|
|
borderRadius: BorderRadius.all(Radius.circular(50))),
|
|
borderRadius: BorderRadius.all(Radius.circular(50))),
|
|
|
- child: Text(historyFunction.ongoingList[i]['title'], style: TextStyle(color: historyModuleListen.checkPressAttention(historyFunction.ongoingList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
|
|
|
|
|
|
|
+ child: Text(historyFunction.ongoingList[i]['title'], style: TextStyle(color: historyModuleListen.checkSelectedFilter(historyFunction.ongoingList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
|
|
|
),
|
|
),
|
|
|
onTap: () {
|
|
onTap: () {
|
|
|
if (!historyModule.isLoadHistory()) {
|
|
if (!historyModule.isLoadHistory()) {
|
|
|
- if (historyModule.checkPressAttention(historyFunction.ongoingList[i]['value'])) {
|
|
|
|
|
- historyModule.setPressAttention(0);
|
|
|
|
|
|
|
+ if (historyModule.checkSelectedFilter(historyFunction.ongoingList[i]['value'])) {
|
|
|
|
|
+ historyModule.setSelectedFilter('none');
|
|
|
historyFunction.onRefresh();
|
|
historyFunction.onRefresh();
|
|
|
} else {
|
|
} else {
|
|
|
- historyModule.setPressAttention(historyFunction.ongoingList[i]['value']);
|
|
|
|
|
|
|
+ historyModule.setSelectedFilter(historyFunction.ongoingList[i]['value']);
|
|
|
historyFunction.onRefresh();
|
|
historyFunction.onRefresh();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -404,18 +415,18 @@ class _MobHistoryPageState extends State<MobHistoryPage> with TickerProviderStat
|
|
|
margin: EdgeInsets.only(left: 16),
|
|
margin: EdgeInsets.only(left: 16),
|
|
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
|
decoration: BoxDecoration(
|
|
decoration: BoxDecoration(
|
|
|
- color: historyModuleListen.checkPressAttention(historyFunction.doneList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
|
|
|
|
|
- border: Border.all(color: historyModuleListen.checkPressAttention(historyFunction.doneList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
|
|
|
|
|
|
|
+ color: historyModuleListen.checkSelectedFilter(historyFunction.doneList[i]['value']) ? primaryColor : Color(0xffF2F8F7),
|
|
|
|
|
+ border: Border.all(color: historyModuleListen.checkSelectedFilter(historyFunction.doneList[i]['value']) ? primaryColor : Color(0xffBEC1C1)),
|
|
|
borderRadius: BorderRadius.all(Radius.circular(50))),
|
|
borderRadius: BorderRadius.all(Radius.circular(50))),
|
|
|
- child: Text(historyFunction.doneList[i]['title'], style: TextStyle(color: historyModuleListen.checkPressAttention(historyFunction.doneList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
|
|
|
|
|
|
|
+ child: Text(historyFunction.doneList[i]['title'], style: TextStyle(color: historyModuleListen.checkSelectedFilter(historyFunction.doneList[i]['value']) ? Colors.white : textColor, fontSize: 16)),
|
|
|
),
|
|
),
|
|
|
onTap: () {
|
|
onTap: () {
|
|
|
if (!historyModule.isLoadHistory()) {
|
|
if (!historyModule.isLoadHistory()) {
|
|
|
- if (historyModule.checkPressAttention(historyFunction.doneList[i]['value'])) {
|
|
|
|
|
- historyModule.setPressAttention(0);
|
|
|
|
|
|
|
+ if (historyModule.checkSelectedFilter(historyFunction.doneList[i]['value'])) {
|
|
|
|
|
+ historyModule.setSelectedFilter(0);
|
|
|
historyFunction.onRefresh();
|
|
historyFunction.onRefresh();
|
|
|
} else {
|
|
} else {
|
|
|
- historyModule.setPressAttention(historyFunction.doneList[i]['value']);
|
|
|
|
|
|
|
+ historyModule.setSelectedFilter(historyFunction.doneList[i]['value']);
|
|
|
historyFunction.onRefresh();
|
|
historyFunction.onRefresh();
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|