added meja edit and meja history log page
This commit is contained in:
@ -138,14 +138,18 @@ class StackedRouter extends _i1.RouterBase {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i8.MejaEditView: (data) {
|
_i8.MejaEditView: (data) {
|
||||||
|
final args = data.getArgs<MejaEditViewArguments>(nullOk: false);
|
||||||
return _i10.MaterialPageRoute<dynamic>(
|
return _i10.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i8.MejaEditView(),
|
builder: (context) =>
|
||||||
|
_i8.MejaEditView(key: args.key, mejaId: args.mejaId),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_i9.MejaHistoryLogView: (data) {
|
_i9.MejaHistoryLogView: (data) {
|
||||||
|
final args = data.getArgs<MejaHistoryLogViewArguments>(nullOk: false);
|
||||||
return _i10.MaterialPageRoute<dynamic>(
|
return _i10.MaterialPageRoute<dynamic>(
|
||||||
builder: (context) => const _i9.MejaHistoryLogView(),
|
builder: (context) =>
|
||||||
|
_i9.MejaHistoryLogView(key: args.key, mejaId: args.mejaId),
|
||||||
settings: data,
|
settings: data,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -184,6 +188,60 @@ class MejaDetailViewArguments {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MejaEditViewArguments {
|
||||||
|
const MejaEditViewArguments({
|
||||||
|
this.key,
|
||||||
|
required this.mejaId,
|
||||||
|
});
|
||||||
|
|
||||||
|
final _i10.Key? key;
|
||||||
|
|
||||||
|
final String mejaId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return '{"key": "$key", "mejaId": "$mejaId"}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(covariant MejaEditViewArguments other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
return other.key == key && other.mejaId == mejaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return key.hashCode ^ mejaId.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MejaHistoryLogViewArguments {
|
||||||
|
const MejaHistoryLogViewArguments({
|
||||||
|
this.key,
|
||||||
|
required this.mejaId,
|
||||||
|
});
|
||||||
|
|
||||||
|
final _i10.Key? key;
|
||||||
|
|
||||||
|
final String mejaId;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return '{"key": "$key", "mejaId": "$mejaId"}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(covariant MejaHistoryLogViewArguments other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
return other.key == key && other.mejaId == mejaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode {
|
||||||
|
return key.hashCode ^ mejaId.hashCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class AdminIndexTrackingViewRoutes {
|
class AdminIndexTrackingViewRoutes {
|
||||||
static const mejaListView = '';
|
static const mejaListView = '';
|
||||||
|
|
||||||
@ -342,28 +400,34 @@ extension NavigatorStateExtension on _i15.NavigationService {
|
|||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToMejaEditView([
|
Future<dynamic> navigateToMejaEditView({
|
||||||
|
_i10.Key? key,
|
||||||
|
required String mejaId,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
]) async {
|
}) async {
|
||||||
return navigateTo<dynamic>(Routes.mejaEditView,
|
return navigateTo<dynamic>(Routes.mejaEditView,
|
||||||
|
arguments: MejaEditViewArguments(key: key, mejaId: mejaId),
|
||||||
id: routerId,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> navigateToMejaHistoryLogView([
|
Future<dynamic> navigateToMejaHistoryLogView({
|
||||||
|
_i10.Key? key,
|
||||||
|
required String mejaId,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
]) async {
|
}) async {
|
||||||
return navigateTo<dynamic>(Routes.mejaHistoryLogView,
|
return navigateTo<dynamic>(Routes.mejaHistoryLogView,
|
||||||
|
arguments: MejaHistoryLogViewArguments(key: key, mejaId: mejaId),
|
||||||
id: routerId,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
@ -515,28 +579,34 @@ extension NavigatorStateExtension on _i15.NavigationService {
|
|||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithMejaEditView([
|
Future<dynamic> replaceWithMejaEditView({
|
||||||
|
_i10.Key? key,
|
||||||
|
required String mejaId,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
]) async {
|
}) async {
|
||||||
return replaceWith<dynamic>(Routes.mejaEditView,
|
return replaceWith<dynamic>(Routes.mejaEditView,
|
||||||
|
arguments: MejaEditViewArguments(key: key, mejaId: mejaId),
|
||||||
id: routerId,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
transition: transition);
|
transition: transition);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> replaceWithMejaHistoryLogView([
|
Future<dynamic> replaceWithMejaHistoryLogView({
|
||||||
|
_i10.Key? key,
|
||||||
|
required String mejaId,
|
||||||
int? routerId,
|
int? routerId,
|
||||||
bool preventDuplicates = true,
|
bool preventDuplicates = true,
|
||||||
Map<String, String>? parameters,
|
Map<String, String>? parameters,
|
||||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||||
transition,
|
transition,
|
||||||
]) async {
|
}) async {
|
||||||
return replaceWith<dynamic>(Routes.mejaHistoryLogView,
|
return replaceWith<dynamic>(Routes.mejaHistoryLogView,
|
||||||
|
arguments: MejaHistoryLogViewArguments(key: key, mejaId: mejaId),
|
||||||
id: routerId,
|
id: routerId,
|
||||||
preventDuplicates: preventDuplicates,
|
preventDuplicates: preventDuplicates,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
|
@ -3,6 +3,7 @@ import 'package:stacked/stacked.dart';
|
|||||||
|
|
||||||
import '../../../../../app/themes/app_colors.dart';
|
import '../../../../../app/themes/app_colors.dart';
|
||||||
import '../../../../../app/themes/app_text.dart';
|
import '../../../../../app/themes/app_text.dart';
|
||||||
|
import '../../../../../app/app.router.dart';
|
||||||
import './meja_detail_view_model.dart';
|
import './meja_detail_view_model.dart';
|
||||||
|
|
||||||
class MejaDetailView extends StatelessWidget {
|
class MejaDetailView extends StatelessWidget {
|
||||||
@ -27,6 +28,7 @@ class MejaDetailView extends StatelessWidget {
|
|||||||
) {
|
) {
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
|
model.log.i('onWillPop ${model.globalVar.backPressed}');
|
||||||
if (model.globalVar.backPressed == 'backNormal') {
|
if (model.globalVar.backPressed == 'backNormal') {
|
||||||
model.globalVar.backPressed = 'exitApp';
|
model.globalVar.backPressed = 'exitApp';
|
||||||
return true;
|
return true;
|
||||||
@ -37,8 +39,8 @@ class MejaDetailView extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('MejaDetailView',
|
title: Text('Detail ${model.namaMeja}',
|
||||||
style: TextStyle(color: Colors.white)),
|
style: const TextStyle(color: Colors.white)),
|
||||||
backgroundColor: mainColor,
|
backgroundColor: mainColor,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@ -225,7 +227,9 @@ class MejaDetailView extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
model.log.i('Edit');
|
// model.log.i('Edit');
|
||||||
|
model.navigationService
|
||||||
|
.navigateToMejaEditView(mejaId: mejaId);
|
||||||
},
|
},
|
||||||
child: const Column(
|
child: const Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -258,6 +262,8 @@ class MejaDetailView extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
model.log.i('List');
|
model.log.i('List');
|
||||||
// model.navigationService.navigateToMakananListView();
|
// model.navigationService.navigateToMakananListView();
|
||||||
|
model.navigationService
|
||||||
|
.navigateToMejaHistoryLogView(mejaId: mejaId);
|
||||||
},
|
},
|
||||||
child: const Column(
|
child: const Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
@ -1,27 +1,208 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
||||||
|
import '../../../../../app/themes/app_colors.dart';
|
||||||
|
import '../../../../../app/themes/app_text.dart';
|
||||||
import './meja_edit_view_model.dart';
|
import './meja_edit_view_model.dart';
|
||||||
|
|
||||||
class MejaEditView extends StatelessWidget {
|
class MejaEditView extends StatelessWidget {
|
||||||
const MejaEditView({super.key});
|
final String mejaId;
|
||||||
|
const MejaEditView({
|
||||||
|
Key? key,
|
||||||
|
required this.mejaId,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ViewModelBuilder<MejaEditViewModel>.reactive(
|
return ViewModelBuilder<MejaEditViewModel>.reactive(
|
||||||
viewModelBuilder: () => MejaEditViewModel(),
|
viewModelBuilder: () => MejaEditViewModel(),
|
||||||
onViewModelReady: (MejaEditViewModel model) async {
|
onViewModelReady: (MejaEditViewModel model) async {
|
||||||
await model.init();
|
await model.init(mejaId);
|
||||||
},
|
},
|
||||||
builder: (
|
builder: (
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
MejaEditViewModel model,
|
MejaEditViewModel model,
|
||||||
Widget? child,
|
Widget? child,
|
||||||
) {
|
) {
|
||||||
return const Scaffold(
|
return WillPopScope(
|
||||||
body: Center(
|
onWillPop: () async {
|
||||||
|
model.log.i(
|
||||||
|
'backPressed : ${model.globalVar.backPressed} in MejaEditView');
|
||||||
|
if (model.globalVar.backPressed == 'backNormal') {
|
||||||
|
// model.globalVar.backPressed = 'exitApp';
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// model.quitApp(context);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text('Edit Detail ${model.namaMeja}',
|
||||||
|
style: const TextStyle(color: Colors.white)),
|
||||||
|
backgroundColor: mainColor,
|
||||||
|
leading: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
if (model.globalVar.backPressed == 'backNormal') {
|
||||||
|
model.globalVar.backPressed = 'exitApp';
|
||||||
|
model.navigationService.back();
|
||||||
|
// return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: 250,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
color: mainGrey,
|
||||||
|
),
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'MejaEditView',
|
'Insert Image',
|
||||||
|
style: regularTextStyle.copyWith(
|
||||||
|
fontSize: 20,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
bottom: 10,
|
||||||
|
right: 10,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () {},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.camera_alt,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Text(
|
||||||
|
model.namaMeja,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
// fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
text: 'Status : ',
|
||||||
|
style: regularTextStyle,
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: 'Tersedia',
|
||||||
|
style: regularTextStyle.copyWith(
|
||||||
|
color: Colors.green,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
text: 'Kapasitas : ',
|
||||||
|
style: regularTextStyle,
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: 'Maksimal 8 Orang',
|
||||||
|
style: regularTextStyle.copyWith(
|
||||||
|
color: Colors.green,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {},
|
||||||
|
icon: const Icon(Icons.edit),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
text: 'Lokasi : ',
|
||||||
|
style: regularTextStyle,
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: 'Luar Ruangan',
|
||||||
|
style: regularTextStyle.copyWith(
|
||||||
|
color: Colors.green,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
text: 'Harga : ',
|
||||||
|
style: regularTextStyle,
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: 'Rp. 20.000',
|
||||||
|
style: regularTextStyle.copyWith(
|
||||||
|
color: Colors.orange,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {},
|
||||||
|
icon: const Icon(Icons.edit),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const Expanded(child: SizedBox(height: 10)),
|
||||||
|
SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 50,
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
model.navigationService.back();
|
||||||
|
},
|
||||||
|
child: const Text('Simpan Perubahan'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,28 @@
|
|||||||
|
import '../../../../../app/app.logger.dart';
|
||||||
import '../../../../../app/core/custom_base_view_model.dart';
|
import '../../../../../app/core/custom_base_view_model.dart';
|
||||||
|
|
||||||
class MejaEditViewModel extends CustomBaseViewModel {
|
class MejaEditViewModel extends CustomBaseViewModel {
|
||||||
Future<void> init() async {
|
final log = getLogger('MejaEditViewModel');
|
||||||
|
late String mejaId;
|
||||||
|
late String namaMeja;
|
||||||
|
Future<void> init(String mejaId) async {
|
||||||
globalVar.backPressed = 'backNormal';
|
globalVar.backPressed = 'backNormal';
|
||||||
|
log.i('MejaEditViewModel init mejaId : $mejaId');
|
||||||
|
|
||||||
|
this.mejaId = mejaId;
|
||||||
|
|
||||||
|
// seperate the number from the string
|
||||||
|
var number = int.parse(mejaId.replaceAll(RegExp(r'[^0-9]'), ''));
|
||||||
|
// log.i('number : $number');
|
||||||
|
if (number <= 4) {
|
||||||
|
namaMeja = 'Gazebo';
|
||||||
|
} else if (number >= 5 && number <= 12) {
|
||||||
|
namaMeja = 'Meja';
|
||||||
|
} else if (number >= 13 && number <= 22) {
|
||||||
|
namaMeja = 'Meja';
|
||||||
|
}
|
||||||
|
namaMeja = '$namaMeja $number';
|
||||||
|
notifyListeners();
|
||||||
|
log.i('backPressed : ${globalVar.backPressed}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,107 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
||||||
|
import '../../../../../app/themes/app_colors.dart';
|
||||||
|
import '../../../../../app/themes/app_text.dart';
|
||||||
import './meja_history_log_view_model.dart';
|
import './meja_history_log_view_model.dart';
|
||||||
|
|
||||||
class MejaHistoryLogView extends StatelessWidget {
|
class MejaHistoryLogView extends StatelessWidget {
|
||||||
const MejaHistoryLogView({super.key});
|
final String mejaId;
|
||||||
|
const MejaHistoryLogView({Key? key, required this.mejaId}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ViewModelBuilder<MejaHistoryLogViewModel>.reactive(
|
return ViewModelBuilder<MejaHistoryLogViewModel>.reactive(
|
||||||
viewModelBuilder: () => MejaHistoryLogViewModel(),
|
viewModelBuilder: () => MejaHistoryLogViewModel(),
|
||||||
onViewModelReady: (MejaHistoryLogViewModel model) async {
|
onViewModelReady: (MejaHistoryLogViewModel model) async {
|
||||||
await model.init();
|
await model.init(mejaId);
|
||||||
},
|
},
|
||||||
builder: (
|
builder: (
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
MejaHistoryLogViewModel model,
|
MejaHistoryLogViewModel model,
|
||||||
Widget? child,
|
Widget? child,
|
||||||
) {
|
) {
|
||||||
return const Scaffold(
|
return WillPopScope(
|
||||||
body: Center(
|
onWillPop: () async {
|
||||||
child: Text(
|
model.log.i(
|
||||||
'MejaHistoryLogView',
|
'backPressed : ${model.globalVar.backPressed} in MejaHistoryLogView');
|
||||||
|
if (model.globalVar.backPressed == 'backNormal') {
|
||||||
|
// model.globalVar.backPressed = 'exitApp';
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// model.quitApp(context);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text('History Log ${model.namaMeja}',
|
||||||
|
style: const TextStyle(color: Colors.white)),
|
||||||
|
backgroundColor: mainColor,
|
||||||
|
leading: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
if (model.globalVar.backPressed == 'backNormal') {
|
||||||
|
model.globalVar.backPressed = 'exitApp';
|
||||||
|
model.navigationService.back();
|
||||||
|
// return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(15),
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: 2,
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
// make the color random between red and blue
|
||||||
|
const color = Colors.blue;
|
||||||
|
String pesanStatus = 'Menunggu Pengesahan';
|
||||||
|
return Card(
|
||||||
|
color: color,
|
||||||
|
child: ListTile(
|
||||||
|
// leading: CircleAvatar(
|
||||||
|
// backgroundColor: Colors.white,
|
||||||
|
// child: Text(
|
||||||
|
// index.toString(),
|
||||||
|
// style: regularTextStyle,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
title: Text(
|
||||||
|
'Nama Pemesan',
|
||||||
|
style: regularTextStyle.copyWith(
|
||||||
|
fontSize: 18,
|
||||||
|
color: Colors.white,
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const Text(
|
||||||
|
'08:00.00 - 09:00.00',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
pesanStatus,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
trailing: const Icon(Icons.arrow_forward_ios,
|
||||||
|
color: Colors.white),
|
||||||
|
onTap: () {
|
||||||
|
model.log.i('Meja 1');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -1,7 +1,28 @@
|
|||||||
|
import '../../../../../app/app.logger.dart';
|
||||||
import '../../../../../app/core/custom_base_view_model.dart';
|
import '../../../../../app/core/custom_base_view_model.dart';
|
||||||
|
|
||||||
class MejaHistoryLogViewModel extends CustomBaseViewModel {
|
class MejaHistoryLogViewModel extends CustomBaseViewModel {
|
||||||
Future<void> init() async {
|
final log = getLogger('MejaHistoryLogViewModel');
|
||||||
|
late String mejaId;
|
||||||
|
late String namaMeja;
|
||||||
|
Future<void> init(String mejaId) async {
|
||||||
globalVar.backPressed = 'backNormal';
|
globalVar.backPressed = 'backNormal';
|
||||||
|
log.i('MejaEditViewModel init mejaId : $mejaId');
|
||||||
|
|
||||||
|
this.mejaId = mejaId;
|
||||||
|
|
||||||
|
// seperate the number from the string
|
||||||
|
var number = int.parse(mejaId.replaceAll(RegExp(r'[^0-9]'), ''));
|
||||||
|
// log.i('number : $number');
|
||||||
|
if (number <= 4) {
|
||||||
|
namaMeja = 'Gazebo';
|
||||||
|
} else if (number >= 5 && number <= 12) {
|
||||||
|
namaMeja = 'Meja';
|
||||||
|
} else if (number >= 13 && number <= 22) {
|
||||||
|
namaMeja = 'Meja';
|
||||||
|
}
|
||||||
|
namaMeja = '$namaMeja $number';
|
||||||
|
notifyListeners();
|
||||||
|
log.i('backPressed : ${globalVar.backPressed}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user