295 lines
11 KiB
Dart
295 lines
11 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:text_scroll/text_scroll.dart';
|
|
|
|
import '../app/constant.dart';
|
|
import '../model/display_counter_dedicated_modelv2.dart';
|
|
import '../model/service_model.dart';
|
|
import '../widget/clock.dart';
|
|
import '../widget/my_antrian_customer_service_dedicated.dart';
|
|
import '../widget/my_counter_customer_service_dedicated.dart';
|
|
import 'customer_service_dedicatedv2.dart';
|
|
|
|
class DisplayTanpaPromo extends StatelessWidget {
|
|
const DisplayTanpaPromo(
|
|
{Key? key,
|
|
required this.isLoading,
|
|
required this.judul,
|
|
required this.scrlCnt,
|
|
required this.selectedCounter,
|
|
required this.listBelumDilayani,
|
|
required this.listCall,
|
|
required this.listSedangDilayani})
|
|
: super(key: key);
|
|
|
|
final ValueNotifier<bool> isLoading;
|
|
final ValueNotifier<String> judul;
|
|
final ScrollController scrlCnt;
|
|
final ValueNotifier<List<Layanan>> selectedCounter;
|
|
final ValueNotifier<List<NotServed>> listBelumDilayani;
|
|
|
|
final ValueNotifier<List<Call>> listCall;
|
|
final ValueNotifier<List<Served>> listSedangDilayani;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
getNomorAntrian(String counterID) {
|
|
var rawCall = listCall.value;
|
|
// print(rawCall);
|
|
Call call = Call(
|
|
queueID: '0',
|
|
statusID: '0',
|
|
queueNumber: '0',
|
|
queueCounterID: '0',
|
|
counterCode: '0',
|
|
orderStatus: '0');
|
|
for (var i = 0; i < rawCall.length; i++) {
|
|
if (rawCall[i].queueCounterID == counterID) {
|
|
call = rawCall[i];
|
|
}
|
|
}
|
|
|
|
var rawProcess = listSedangDilayani.value;
|
|
Served process = Served(
|
|
queueID: '0',
|
|
statusID: '0',
|
|
queueNumber: '0',
|
|
queueCounterID: '0',
|
|
counterCode: '0',
|
|
orderStatus: '0');
|
|
|
|
for (var i = 0; i < rawProcess.length; i++) {
|
|
if (rawProcess[i].queueCounterID == counterID) {
|
|
process = rawProcess[i];
|
|
}
|
|
}
|
|
if (call.queueID != '0' && process.queueID == '0') {
|
|
return call.queueNumber;
|
|
} else if (call.queueID == '0' && process.queueID != '0') {
|
|
return process.queueNumber;
|
|
} else if (call.queueID == '0' && process.queueID == '0') {
|
|
return '-';
|
|
} else {
|
|
return call.queueNumber;
|
|
}
|
|
}
|
|
|
|
getBlinkAntrian(String counterID) {
|
|
var rawCall = listCall.value;
|
|
// print(rawCall);
|
|
Call call = Call(
|
|
queueID: '0',
|
|
statusID: '0',
|
|
queueNumber: '0',
|
|
queueCounterID: '0',
|
|
counterCode: '0',
|
|
orderStatus: '0');
|
|
for (var i = 0; i < rawCall.length; i++) {
|
|
if (rawCall[i].queueCounterID == counterID) {
|
|
call = rawCall[i];
|
|
}
|
|
}
|
|
|
|
var rawProcess = listSedangDilayani.value;
|
|
Served process = Served(
|
|
queueID: '0',
|
|
statusID: '0',
|
|
queueNumber: '0',
|
|
queueCounterID: '0',
|
|
counterCode: '0',
|
|
orderStatus: '0');
|
|
|
|
for (var i = 0; i < rawProcess.length; i++) {
|
|
if (rawProcess[i].queueCounterID == counterID) {
|
|
process = rawProcess[i];
|
|
}
|
|
}
|
|
if (call.queueID != '0' && process.queueID == '0') {
|
|
return true;
|
|
} else if (call.queueID == '0' && process.queueID != '0') {
|
|
return false;
|
|
} else if (call.queueID == '0' && process.queueID == '0') {
|
|
return false;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return Material(
|
|
child: Container(
|
|
width: Constant.getActualX(context: context, x: 1920),
|
|
height: Constant.getActualY(context: context, y: 1080),
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage('images/background.png'), fit: BoxFit.fill),
|
|
),
|
|
child: Padding(
|
|
padding:
|
|
const EdgeInsets.only(left: 68, right: 68, top: 34, bottom: 32),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// judul start
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
flex: 3,
|
|
child: Container(
|
|
// color: Colors.green,
|
|
// width: Constant.getActualX(context: context, x: 900),
|
|
height: Constant.getActualY(context: context, y: 120),
|
|
child: Stack(
|
|
alignment: Alignment.centerLeft,
|
|
children: [
|
|
Container(
|
|
width:
|
|
Constant.getActualX(context: context, x: 1400),
|
|
height:
|
|
Constant.getActualY(context: context, y: 72),
|
|
decoration: BoxDecoration(
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.25),
|
|
blurRadius: 8)
|
|
],
|
|
borderRadius: BorderRadius.circular(20),
|
|
color: Colors.white),
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(
|
|
top: 6,
|
|
left: 80,
|
|
),
|
|
child: Stack(
|
|
alignment: Alignment.centerLeft,
|
|
children: [
|
|
if (isLoading.value)
|
|
SizedBox(
|
|
width: Constant.getActualX(
|
|
context: context, x: 60),
|
|
height: Constant.getActualX(
|
|
context: context, x: 70),
|
|
child: const CircularProgressIndicator(),
|
|
),
|
|
Padding(
|
|
padding:
|
|
EdgeInsets.only(left: 40, right: 40),
|
|
child: TextScroll(
|
|
judul.value,
|
|
velocity: Velocity(
|
|
pixelsPerSecond: Offset(50, 0)),
|
|
style: Constant.body_3(context: context)
|
|
.copyWith(color: Constant.textRed),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width:
|
|
Constant.getActualX(context: context, x: 100),
|
|
height:
|
|
Constant.getActualY(context: context, y: 100),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(20),
|
|
gradient: LinearGradient(
|
|
colors: [Constant.red1, Constant.red2])),
|
|
),
|
|
Positioned(
|
|
top: 0,
|
|
child: Image.asset(
|
|
'images/cs.png',
|
|
fit: BoxFit.cover,
|
|
height: 100,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 1,
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(left: 10),
|
|
child: Clock(),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
// judul end
|
|
|
|
// counter list start
|
|
Expanded(
|
|
child: Container(
|
|
// color: Colors.blue,
|
|
width: Constant.getActualX(context: context, x: 1920),
|
|
height: Constant.getActualY(context: context, y: 400),
|
|
child: GridView.count(
|
|
scrollDirection: Axis.horizontal,
|
|
controller: scrlCnt,
|
|
crossAxisSpacing: 0.6,
|
|
// mainAxisSpacing: 30,
|
|
childAspectRatio: 1,
|
|
crossAxisCount: 1,
|
|
children: selectedCounter.value
|
|
.map(
|
|
(e) => MyCounterCustomerServiceDedicated(
|
|
// counter: 'DOKTER UMUM',
|
|
counter: 'Counter ${e.counterCode}',
|
|
nomorAntrian:
|
|
getNomorAntrian(e.counterID.toString()),
|
|
// nomorAntrian: 'LA 001',
|
|
borderDalam: const BorderRadius.only(
|
|
topLeft: Radius.circular(50),
|
|
topRight: Radius.circular(50),
|
|
bottomLeft: Radius.circular(50)),
|
|
borderLuar: const BorderRadius.only(
|
|
topLeft: Radius.circular(60),
|
|
topRight: Radius.circular(60),
|
|
bottomLeft: Radius.circular(60),
|
|
),
|
|
blink: getBlinkAntrian(e.counterID.toString()),
|
|
),
|
|
)
|
|
.toList()),
|
|
),
|
|
),
|
|
// counter list end
|
|
|
|
// antrian selanjutnya start
|
|
SizedBox(
|
|
width: Constant.getActualX(context: context, x: 882),
|
|
height: Constant.getActualY(context: context, y: 66),
|
|
child: Text('Antrian Selanjutnya',
|
|
style: Constant.S50(context: context)
|
|
.copyWith(color: Constant.textBlack)),
|
|
),
|
|
SizedBox(
|
|
height: Constant.getActualY(context: context, y: 24),
|
|
),
|
|
Container(
|
|
// color: Colors.yellowAccent,
|
|
width: Constant.getActualX(context: context, x: 1920),
|
|
height: Constant.getActualY(context: context, y: 360),
|
|
child: GridView.count(
|
|
crossAxisSpacing: 10,
|
|
mainAxisSpacing: 0,
|
|
crossAxisCount: 3,
|
|
childAspectRatio: 5,
|
|
children: listBelumDilayani.value
|
|
.map(
|
|
(e) => MyAntrianCustomerServiceDedicated(
|
|
antrian: e.queueNumber,
|
|
skip: e.skipQueue,
|
|
),
|
|
)
|
|
.toList(),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|