You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
5.2 KiB
Dart
144 lines
5.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
import 'package:test_sa/extensions/string_extensions.dart';
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
import 'package:test_sa/helper/utils.dart';
|
|
import 'package:test_sa/models/lookup.dart';
|
|
import 'package:test_sa/models/site_contact_info_model.dart';
|
|
import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
|
|
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
|
|
import 'package:url_launcher/url_launcher_string.dart';
|
|
|
|
import '../../new_views/app_style/app_color.dart';
|
|
import '../../new_views/common_widgets/app_filled_button.dart';
|
|
import '../cm_module/views/components/action_button/footer_action_button.dart';
|
|
import '../loan_module/provider/loan_period_provider.dart';
|
|
|
|
class DemoExtensionBottomSheet extends StatelessWidget {
|
|
const DemoExtensionBottomSheet({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
clipBehavior: Clip.antiAlias,
|
|
// height: MediaQuery.sizeOf(context).height * .5,
|
|
decoration: const BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.only(
|
|
topRight: Radius.circular(30),
|
|
topLeft: Radius.circular(30),
|
|
),
|
|
),
|
|
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
|
|
child: SafeArea(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Container(
|
|
width: 40.toScreenWidth,
|
|
height: 5.toScreenHeight,
|
|
decoration: BoxDecoration(color: AppColor.neutral40, borderRadius: BorderRadius.circular(30)),
|
|
),
|
|
16.height,
|
|
Align(
|
|
alignment: AlignmentDirectional.centerStart,
|
|
child: Text(
|
|
"Select Demo Period",
|
|
style: AppTextStyles.heading3.copyWith(fontWeight: FontWeight.w600, color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
),
|
|
),
|
|
16.height,
|
|
SingleItemDropDownMenu<Lookup, LoanPeriodProvider>(
|
|
context: context,
|
|
height: 56.toScreenHeight,
|
|
title: 'Demo Period'.addTranslation,
|
|
showShadow: false,
|
|
validator: (value) {
|
|
if (value == null) return "Please select loan period";
|
|
return null;
|
|
},
|
|
backgroundColor: AppColor.fieldBgColor(context),
|
|
showAsBottomSheet: true,
|
|
// initialValue: _loanFormModel.loanProvided,
|
|
onSelect: (status) {
|
|
// if (status != null) {
|
|
// _loanFormModel.loanProvided = status;
|
|
// setState(() {});
|
|
// }
|
|
},
|
|
),
|
|
36.height,
|
|
Row(
|
|
children: [
|
|
AppFilledButton(
|
|
label: context.translation.cancel,
|
|
buttonColor: AppColor.white60,
|
|
textColor: AppColor.black10,
|
|
loading: false,
|
|
onPressed: () async {
|
|
Navigator.pop(context);
|
|
},
|
|
).expanded,
|
|
16.width,
|
|
AppFilledButton(
|
|
buttonColor: AppColor.primary10,
|
|
label: context.translation.submit,
|
|
onPressed: () {
|
|
Utils.showLoading(context);
|
|
Future.delayed(Duration(milliseconds: 500), () {
|
|
// api call to submits
|
|
Utils.hideLoading(context);
|
|
Navigator.pop(context);
|
|
// api call to get fresh data
|
|
});
|
|
},
|
|
).expanded,
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
void _launchWhatsapp(String number) async {
|
|
var whatsappUrl = "https://wa.me/$number/?text=${Uri.parse("Hi, I need some help")}";
|
|
try {
|
|
if (await canLaunchUrlString(whatsappUrl)) {
|
|
await launchUrlString(whatsappUrl);
|
|
} else {
|
|
throw 'Could not launch $whatsappUrl';
|
|
}
|
|
} catch (e) {
|
|
print('Error launching WhatsApp: $e');
|
|
}
|
|
}
|
|
|
|
Widget contactItem(BuildContext context, bool isDark, String iconName, String title, String subtitle) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SvgPicture.asset(
|
|
"assets/images/$iconName.svg",
|
|
width: 32.toScreenWidth,
|
|
color: isDark ? AppColor.primary40 : AppColor.primary70,
|
|
),
|
|
30.height,
|
|
Text(
|
|
title,
|
|
style: AppTextStyles.heading6.copyWith(color: isDark ? AppColor.neutral30 : AppColor.neutral50),
|
|
),
|
|
Text(
|
|
subtitle,
|
|
style: AppTextStyles.bodyText.copyWith(color: isDark ? AppColor.neutral10 : AppColor.neutral20),
|
|
),
|
|
],
|
|
).toShadowContainer(context);
|
|
}
|
|
}
|