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.
PatientApp-KKUMC/lib/pages/packages_offers/PackageOrderCompletedPage.dart

147 lines
4.0 KiB
Dart

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: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, @required this.heading, @required this.title, @required 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<PackagesViewModel>(
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) => Text(
heading,
textAlign: TextAlign.center,
maxLines: 1,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 35.0,
fontWeight: FontWeight.bold,
letterSpacing: 0.9
)
);
Widget titleWidget(BuildContext context) => Text(
title,
textAlign: TextAlign.center,
maxLines: 2,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 25.0,
fontWeight: FontWeight.w200,
letterSpacing: 0.9
)
);
Widget subTitleWidget(BuildContext context) => Text(
subTitle,
textAlign: TextAlign.center,
maxLines: 2,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize: 15.0,
fontWeight: FontWeight.normal,
letterSpacing: 0.9
)
);
Widget actionWidget(BuildContext context) => Container(
height: buttonHeight,
width: buttonWidth,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape:RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(buttonHeight/2),
)
),
child: Text(
actionTitle,
style: TextStyle(
color: Colors.white,
fontSize: 18.0,
fontWeight: FontWeight.normal,
)
),
onPressed: (){
Navigator.of(context).pop();
},
),
);
}