complete admin, mandor and user page
This commit is contained in:
@ -24,6 +24,9 @@ class PerumahanDetailView extends StatelessWidget {
|
||||
) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
iconTheme: const IconThemeData(
|
||||
color: backgroundColor,
|
||||
),
|
||||
title: Text(
|
||||
'Perumahan Blok ${model.blok} , No. ${model.idRumah}',
|
||||
style: const TextStyle(
|
||||
@ -34,15 +37,7 @@ class PerumahanDetailView extends StatelessWidget {
|
||||
backgroundColor: mainColor,
|
||||
elevation: 0,
|
||||
),
|
||||
body: WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (model.globalVar.backPressed == 'exitApp') {
|
||||
// model.back();
|
||||
return true;
|
||||
// model.quitApp(context);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
body: SafeArea(
|
||||
child: Stack(
|
||||
children: [
|
||||
Padding(
|
||||
@ -190,7 +185,8 @@ class PerumahanDetailView extends StatelessWidget {
|
||||
return Card(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
model.log.i('Card $index tapped');
|
||||
model.checkProgress(
|
||||
model.progressModel![index]);
|
||||
},
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
@ -245,6 +241,70 @@ class PerumahanDetailView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
// create whatsapp button
|
||||
Positioned(
|
||||
top: model.level == 'Mandor' ? 80 : 15,
|
||||
right: 15,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: greenColor,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 7,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
model.openWhatsapp();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.chat_outlined,
|
||||
color: Colors.white,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// create call button
|
||||
Positioned(
|
||||
top: model.level == 'Mandor' ? 145 : 80,
|
||||
right: 15,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: mainColor,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
spreadRadius: 2,
|
||||
blurRadius: 7,
|
||||
offset: const Offset(0, 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
model.call();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.call_outlined,
|
||||
color: Colors.white,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../../../app/app.bottomsheets.dart';
|
||||
import '../../../../app/app.logger.dart';
|
||||
import '../../../../app/app.router.dart';
|
||||
@ -60,7 +62,9 @@ class PerumahanDetailViewModel extends CustomBaseViewModel {
|
||||
var res = await bottomSheetService.showCustomSheet(
|
||||
variant: BottomSheetType.tambahLihatProgressBottomSheetView,
|
||||
title: 'Form Tambah Progress',
|
||||
data: idPerumahan,
|
||||
data: {
|
||||
'idPerumahan': idPerumahan,
|
||||
},
|
||||
);
|
||||
|
||||
if (res!.confirmed) {
|
||||
@ -72,4 +76,37 @@ class PerumahanDetailViewModel extends CustomBaseViewModel {
|
||||
await getData();
|
||||
}
|
||||
}
|
||||
|
||||
checkProgress(ProgressModel progressModel) async {
|
||||
await bottomSheetService.showCustomSheet(
|
||||
variant: BottomSheetType.tambahLihatProgressBottomSheetView,
|
||||
title: 'Lihat Progress',
|
||||
data: {
|
||||
'idPerumahan': idPerumahan,
|
||||
'progressModel': progressModel,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
openWhatsapp() async {
|
||||
// open whatsapp using url
|
||||
String noTelpon = rumahModel!.noTelpon!;
|
||||
// convert the number to international format
|
||||
noTelpon = noTelpon.replaceAll(RegExp(r'[^0-9]'), '');
|
||||
noTelpon = '62${noTelpon.substring(1)}';
|
||||
|
||||
log.i('no_telpon: $noTelpon');
|
||||
final url = Uri.parse('https://wa.me/$noTelpon');
|
||||
|
||||
if (!await launchUrl(url)) {
|
||||
throw Exception('Could not launch $url');
|
||||
}
|
||||
}
|
||||
|
||||
call() async {
|
||||
final Uri callUri = Uri(scheme: 'tel', path: rumahModel!.noTelpon!);
|
||||
if (!await launchUrl(callUri)) {
|
||||
throw 'Could not launch ${callUri.toString()}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user