import 'package:diplomaticquarterapp/core/viewModels/packages_offers/PackagesOffersViewModel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/custom_text_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_svg/svg.dart'; dynamic languageID; class PackageOrderCompletedPage extends StatelessWidget { double? buttonHeight; double? buttonWidth; Widget? icon; String? heading; String? title; String? subTitle; String? actionTitle; PackageOrderCompletedPage({this.buttonWidth, this.buttonHeight, this.heading, this.title, this.subTitle, this.actionTitle}); @override Widget build(BuildContext context) { assert((heading != null || title != null || subTitle != null), "Data missing in properties"); buttonWidth = buttonWidth ?? MediaQuery.of(context).size.width / 2; buttonHeight = buttonHeight ?? 40; actionTitle = actionTitle ?? TranslationBase.of(context).done; return BaseView( allowAny: true, onModelReady: (model) {}, builder: (_, model, wi) { return Container( color: Colors.white, child: Padding( padding: const EdgeInsets.all(15), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ AspectRatio( aspectRatio: 1.2 / 1, child: iconWidget(context), ), headingWidget(context), AspectRatio( aspectRatio: 1 / 1, child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ titleWidget(context), SizedBox( height: 20, ), subTitleWidget(context), SizedBox( height: 50, ), actionWidget(context) ], ), ), ) ], ), ), ); }); } Widget iconWidget(BuildContext context) { return Padding( padding: const EdgeInsets.all(50), child: icon ?? SvgPicture.asset("assets/images/svg/success.svg", semanticsLabel: 'icon'), ); } Widget headingWidget(BuildContext context) => Texts( heading, textAlign: TextAlign.center, maxLines: 1, color: Theme.of(context).primaryColor, fontSize: 35.0, fontWeight: FontWeight.bold, ); Widget titleWidget(BuildContext context) => Texts( title, textAlign: TextAlign.center, maxLines: 2, color: Theme.of(context).primaryColor, fontSize: 25.0, fontWeight: FontWeight.w200, ); Widget subTitleWidget(BuildContext context) => Texts( subTitle, textAlign: TextAlign.center, maxLines: 2, color: Theme.of(context).primaryColor, fontSize: 15.0, fontWeight: FontWeight.normal, ); Widget actionWidget(BuildContext context) => Container( height: buttonHeight, width: buttonWidth, child: CustomTextButton( shape: RoundedRectangleBorder( borderRadius: new BorderRadius.circular(buttonHeight! / 2), ), child: Texts( actionTitle, color: Colors.white, fontSize: 18.0, fontWeight: FontWeight.normal, ), onPressed: () { Navigator.of(context).pop(); }, ), ); }