165 lines
6.2 KiB
Dart
165 lines
6.2 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:initial_folder/screens/certificate/certificate.dart';
|
|
import 'package:initial_folder/screens/coupon/coupon_page.dart';
|
|
import 'package:initial_folder/screens/login/login_screen.dart';
|
|
import 'package:initial_folder/screens/login/login_with_email/login_email_screen.dart';
|
|
import 'package:initial_folder/screens/splash/splash_screen_login.dart';
|
|
import 'package:initial_folder/size_config.dart';
|
|
import 'package:initial_folder/theme.dart';
|
|
import 'package:initial_folder/widgets/custom_navigator_bottom.dart';
|
|
|
|
class CertificateVoucher extends StatelessWidget {
|
|
const CertificateVoucher({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Future _showDialogNotLogin() {
|
|
return showDialog(
|
|
context: context,
|
|
builder: (context) => AlertDialog(
|
|
elevation: 0.0,
|
|
contentPadding: EdgeInsets.symmetric(
|
|
horizontal: getProportionateScreenWidth(20),
|
|
vertical: getProportionateScreenHeight(20),
|
|
),
|
|
content: Text(
|
|
'Mohon login terlebih dahulu sebelum menukarkan kupon',
|
|
style: thirdTextStyle.copyWith(
|
|
fontSize: getProportionateScreenWidth(11)),
|
|
),
|
|
actions: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
child: Text(
|
|
'Batal',
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: getProportionateScreenWidth(12),
|
|
letterSpacing: 1,
|
|
color: primaryColor),
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: getProportionateScreenWidth(5),
|
|
),
|
|
GestureDetector(
|
|
onTap: () => Navigator.of(context).pushNamedAndRemoveUntil(
|
|
LoginEmail.routeName, (Route<dynamic> route) => false),
|
|
child: Text('Login',
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: getProportionateScreenWidth(12),
|
|
letterSpacing: 1,
|
|
color: primaryColor)),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
return IntrinsicHeight(
|
|
child: Column(
|
|
children: [
|
|
SizedBox(height: getProportionateScreenHeight(20)),
|
|
Container(
|
|
height: getProportionateScreenHeight(44),
|
|
decoration: BoxDecoration(
|
|
color: Theme.of(context).colorScheme.primaryContainer,
|
|
borderRadius: BorderRadius.circular(10),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
spreadRadius: -5,
|
|
blurRadius: 10,
|
|
offset: Offset(0, 3),
|
|
),
|
|
],
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
Navigator.of(context, rootNavigator: true).push(
|
|
CustomNavigatorBottom(
|
|
child: Certificate(),
|
|
),
|
|
);
|
|
},
|
|
child: Row(
|
|
children: [
|
|
SvgPicture.asset(
|
|
"assets/icons/certificate.svg",
|
|
color: Theme.of(context).colorScheme.onPrimary,
|
|
width: getProportionateScreenWidth(13),
|
|
),
|
|
SizedBox(width: getProportionateScreenWidth(5)),
|
|
Text(
|
|
'Sertifikat',
|
|
textAlign: TextAlign.start,
|
|
style: thirdTextStyle.copyWith(
|
|
fontSize: getProportionateScreenWidth(12),
|
|
fontWeight: reguler,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(width: getProportionateScreenWidth(40)),
|
|
Container(
|
|
height: getProportionateScreenHeight(18),
|
|
child: VerticalDivider(
|
|
color: Theme.of(context).colorScheme.onPrimary,
|
|
thickness: 1),
|
|
),
|
|
SizedBox(width: getProportionateScreenWidth(40)),
|
|
GestureDetector(
|
|
onTap: () {
|
|
if (Condition.loginEmail || Condition.loginFirebase) {
|
|
showModalBottomSheet(
|
|
elevation: 0,
|
|
backgroundColor:
|
|
Theme.of(context).colorScheme.background,
|
|
context: context,
|
|
builder: (context) => ClipRect(child: CouponPage()),
|
|
isScrollControlled: true,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(0),
|
|
),
|
|
);
|
|
} else if (!Condition.loginEmail ||
|
|
!Condition.loginFirebase) {
|
|
_showDialogNotLogin();
|
|
}
|
|
},
|
|
child: Row(
|
|
children: [
|
|
SvgPicture.asset(
|
|
"assets/icons/voucher.svg",
|
|
color: Theme.of(context).colorScheme.onPrimary,
|
|
width: getProportionateScreenWidth(13),
|
|
),
|
|
SizedBox(width: getProportionateScreenWidth(5)),
|
|
Text(
|
|
'Voucher',
|
|
textAlign: TextAlign.start,
|
|
style: thirdTextStyle.copyWith(
|
|
fontSize: getProportionateScreenWidth(12),
|
|
fontWeight: reguler,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|