import 'package:carousel_slider/carousel_slider.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; 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:provider/provider.dart'; import '../../splashPage.dart'; class NotAutPage extends StatefulWidget { final String title; final String description; final List infoList; final List imagesInfo; NotAutPage( {@required this.title, @required this.description, this.infoList, this.imagesInfo}); @override _NotAutPageState createState() => _NotAutPageState(); } class _NotAutPageState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return Scaffold( body: SingleChildScrollView( padding: EdgeInsets.all(12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( widget.title ?? 'Service', fontWeight: FontWeight.w800, fontSize: 25, bold: true, color: Color(0xff60686b), ), SizedBox( height: 12, ), Texts( widget.description ?? 'Description', fontWeight: FontWeight.normal, fontSize: 17, ), if (widget.infoList != null) SizedBox( height: 12, ), if (widget.infoList != null) ...List.generate( widget.infoList.length, (index) => Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Container( 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, ), 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) CarouselSlider( items: widget.imagesInfo.map((image) { return Builder( builder: (BuildContext context) { 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)); }, ); }).toList(), options: CarouselOptions( height: MediaQuery.of(context).size.height * 0.55, autoPlay: widget.imagesInfo.length > 1, viewportFraction: 1.0, ), ), SizedBox( height: 77, ), ], ), ), bottomSheet: Container( height: MediaQuery.of(context).size.height * 0.10, width: double.infinity, child: Column( children: [ 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, ); } } }