modify reservation table page, add socket io client for real time data update, modify makanan list page

This commit is contained in:
kicap
2023-08-25 04:21:55 +08:00
parent 6c5bfde828
commit d96a14e062
30 changed files with 726 additions and 165 deletions

View File

@ -104,16 +104,14 @@ class ReservasiMejaView extends StatelessWidget {
),
),
Expanded(
// child: SizedBox(),
child: WebView(
initialUrl: dotenv.env['table_url'],
// initialUrl: 'http://172.29.85.181/parkir/user',
// initialUrl: 'https://rekam-medis.airlangga-it.com/',
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
// _controller.complete(webViewController);
// model.controllerCompleter.future
// .then((value) => model.webViewController = value);
// model.controllerCompleter.complete(webViewController);
model.webViewController = webViewController;
},
onProgress: (int progress) {
// model.log.i('WebView is loading (progress : $progress%)');
@ -196,19 +194,19 @@ class ReservasiMejaView extends StatelessWidget {
),
),
const SizedBox(width: 5),
const Text('Tidak Tersedia'),
const Text('Dibooking'),
const SizedBox(width: 10),
Container(
width: 20,
height: 20,
decoration: const BoxDecoration(
color: Colors.blue,
color: Colors.grey,
shape: BoxShape.circle,
),
),
const SizedBox(width: 5),
const Text('Dipesan'),
const Text('Tidak Tersedia'),
const SizedBox(width: 10),
],
),

View File

@ -1,10 +1,16 @@
import 'dart:async';
import 'package:webview_flutter/webview_flutter.dart';
import '../../../../app/app.locator.dart';
import '../../../../app/app.logger.dart';
import '../../../../app/core/custom_base_view_model.dart';
import '../../../../services/my_socket_io_client.dart';
class ReservasiMejaViewModel extends CustomBaseViewModel {
final log = getLogger('ReservasiMejaViewModel');
WebViewController? webViewController;
final socketIoClient = locator<MySocketIoClient>();
List<String> imagePaths = [
'assets/reza_gazebo.jpeg',
@ -14,5 +20,10 @@ class ReservasiMejaViewModel extends CustomBaseViewModel {
Future<void> init() async {
globalVar.backPressed = 'exitApp';
socketIoClient.on('table_admin', (data) {
log.i('data : $data');
// getData();
webViewController!.reload();
});
}
}