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.
diplomatic-quarter/lib/widgets/others/not_auh_page.dart

223 lines
7.9 KiB
Dart

4 years ago
import 'package:carousel_slider/carousel_slider.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
4 years ago
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import '../../splashPage.dart';
4 years ago
class NotAutPage extends StatefulWidget {
final String title;
final String description;
final List<String> infoList;
4 years ago
final List<ImagesInfo> imagesInfo;
final String icon;
4 years ago
NotAutPage({@required this.title, @required this.description, this.infoList, this.imagesInfo, this.icon});
4 years ago
@override
_NotAutPageState createState() => _NotAutPageState();
}
class _NotAutPageState extends State<NotAutPage> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Scaffold(
backgroundColor: Color(0xfff8f8f8),
resizeToAvoidBottomPadding: false,
appBar: AppBar(
backgroundColor: Colors.transparent,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Color(0xff2B353E),
onPressed: () => Navigator.pop(context),
),
),
body: Padding(
padding: EdgeInsets.only(bottom: 20, left: 21, right: 21),
child: Column(children: [
Expanded(
child: ListView(
padding: EdgeInsets.zero,
physics: BouncingScrollPhysics(),
children: [
SizedBox(height: 12),
if (widget.icon != null)
Align(
alignment: Alignment.centerLeft,
child: SvgPicture.asset(
widget.icon,
height: 35,
width: 35,
),
),
SizedBox(height: 16),
Text(
widget.title,
style: TextStyle(fontSize: 24, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 23 / 24),
),
Text(
widget.description,
style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56, height: 21 / 14),
),
],
),
),
SizedBox(
height: 43,
width: double.infinity,
child: FlatButton(
onPressed: () {
loginCheck(context);
},
child: Text(
TranslationBase.of(context).loginregister,
style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.48),
),
// color: Color(0xffD02127),
color: Color(0xffD02127),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6),
),
),
),
]),
),
);
return Scaffold(
body: SingleChildScrollView(
padding: EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(
4 years ago
widget.title ?? 'Service',
fontWeight: FontWeight.w800,
fontSize: 25,
bold: true,
4 years ago
color: Color(0xff60686b),
),
SizedBox(
height: 12,
),
Texts(
4 years ago
widget.description ?? 'Description',
fontWeight: FontWeight.normal,
fontSize: 17,
),
4 years ago
if (widget.infoList != null)
SizedBox(
height: 12,
),
4 years ago
if (widget.infoList != null)
...List.generate(
4 years ago
widget.infoList.length,
(index) => Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
4 years ago
width: 40,
height: 40,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20), color: Theme.of(context).primaryColor),
child: Center(
child: Texts(
'${index + 1}',
color: Colors.white,
),
),
),
SizedBox(
width: 6,
),
4 years ago
Expanded(child: Texts('${widget.infoList[index]}'))
],
),
SizedBox(
height: 12,
),
],
),
),
),
SizedBox(
height: 22,
),
if (!projectViewModel.isInternetConnection)
Center(
child: SizedBox(
height: MediaQuery.of(context).size.height * 0.55,
width: MediaQuery.of(context).size.width * 0.50,
child: Image.asset(projectViewModel.isArabic ? 'assets/images/Wifi-AR.png' : 'assets/images/wifi-EN.png'),
),
),
if (projectViewModel.isInternetConnection && widget.imagesInfo != null)
4 years ago
CarouselSlider(
items: widget.imagesInfo.map((image) {
return Builder(
builder: (BuildContext context) {
4 years ago
return SizedBox(
width: MediaQuery.of(context).size.width * 0.50,
child: image.isAsset ? Image.asset(projectViewModel.isArabic ? image.imageAr : image.imageEn) : Image.network(projectViewModel.isArabic ? image.imageAr : image.imageEn));
4 years ago
},
);
}).toList(),
options: CarouselOptions(
height: MediaQuery.of(context).size.height * 0.55,
autoPlay: widget.imagesInfo.length > 1,
4 years ago
viewportFraction: 1.0,
),
),
SizedBox(
height: 77,
),
],
),
),
bottomSheet: Container(
height: MediaQuery.of(context).size.height * 0.10,
width: double.infinity,
child: Column(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * 0.9,
child: SecondaryButton(
onTap: () {
loginCheck(context);
},
label: TranslationBase.of(context).serviceInformationButton,
textColor: Theme.of(context).backgroundColor),
),
],
),
),
);
}
loginCheck(context) async {
var data = await sharedPref.getObject(IMEI_USER_DATA);
sharedPref.remove(REGISTER_DATA_FOR_LOGIIN);
if (data != null) {
Navigator.of(context).pushNamed(CONFIRM_LOGIN);
} else {
Navigator.of(context).pushNamed(
WELCOME_LOGIN,
);
}
}
}