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.
211 lines
7.5 KiB
Dart
211 lines
7.5 KiB
Dart
import 'package:diplomaticquarterapp/config/config.dart';
|
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
|
|
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
|
|
import 'package:diplomaticquarterapp/routes.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart';
|
|
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart';
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:animated_text_kit/animated_text_kit.dart';
|
|
import '../../locator.dart';
|
|
import 'floating_button_search.dart';
|
|
import '../progress_indicator/app_loader_widget.dart';
|
|
import 'arrow_back.dart';
|
|
import 'network_base_view.dart';
|
|
import 'not_auh_page.dart';
|
|
import 'package:diplomaticquarterapp/widgets/weather_slider/weather_slider.dart';
|
|
class AppScaffold extends StatelessWidget {
|
|
final String appBarTitle;
|
|
final Widget body;
|
|
final Widget bottomSheet;
|
|
final bool isLoading;
|
|
final bool isShowAppBar;
|
|
final bool hasAppBarParam;
|
|
final BaseViewModel baseViewModel;
|
|
final bool isBottomBar;
|
|
final Widget floatingActionButton;
|
|
final String title;
|
|
final String description;
|
|
final String image;
|
|
final bool isShowDecPage;
|
|
final List<String> infoList;
|
|
final Color backgroundColor;
|
|
final bool isHelp;
|
|
AuthenticatedUserObject authenticatedUserObject =
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
AppScaffold(
|
|
{@required this.body,
|
|
this.appBarTitle = '',
|
|
this.isLoading = false,
|
|
this.isShowAppBar = false,
|
|
this.hasAppBarParam,
|
|
this.bottomSheet,
|
|
this.baseViewModel,
|
|
this.floatingActionButton,
|
|
this.title,
|
|
this.description,
|
|
this.isShowDecPage = true,
|
|
this.backgroundColor,
|
|
this.isBottomBar,
|
|
this.image,
|
|
this.infoList,
|
|
this.isHelp
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
AppGlobal.context = context;
|
|
|
|
return Scaffold(
|
|
backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
|
|
appBar: isShowAppBar
|
|
? AppBar(
|
|
elevation: 0,
|
|
backgroundColor: Theme.of(context).appBarTheme.color,
|
|
textTheme: TextTheme(
|
|
headline6:
|
|
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
|
),
|
|
title: Texts(
|
|
authenticatedUserObject.isLogin || !isShowDecPage
|
|
? appBarTitle.toUpperCase()
|
|
: TranslationBase.of(context).serviceInformationTitle,
|
|
color: Colors.white,
|
|
bold: true,
|
|
),
|
|
leading: Builder(
|
|
builder: (BuildContext context) {
|
|
return ArrowBack();
|
|
},
|
|
),
|
|
centerTitle: true,
|
|
actions: <Widget>[
|
|
image != null
|
|
? InkWell(
|
|
onTap: () => Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: InsuranceUpdate(),
|
|
),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Image.asset(
|
|
image,
|
|
height: SizeConfig.heightMultiplier * 5,
|
|
width: SizeConfig.heightMultiplier * 5,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
)
|
|
: IconButton(
|
|
icon: Icon(FontAwesomeIcons.home),
|
|
color: Colors.white,
|
|
onPressed: () {
|
|
Navigator.pushAndRemoveUntil(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => LandingPage()),
|
|
(Route<dynamic> r) => false);
|
|
},
|
|
),
|
|
],
|
|
)
|
|
: null,
|
|
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
|
|
isShowDecPage)
|
|
? NotAutPage(
|
|
title: appBarTitle,
|
|
description: description,
|
|
infoList: infoList,
|
|
)
|
|
: baseViewModel != null
|
|
? NetworkBaseView(
|
|
child: buildBodyWidget(),
|
|
baseViewModel: baseViewModel,
|
|
)
|
|
: buildBodyWidget(),
|
|
bottomSheet: bottomSheet,
|
|
// floatingActionButton: floatingActionButton ?? floatingActionButton,
|
|
// bottomNavigationBar:
|
|
// this.isBottomBar == true ? BottomBarSearch() : SizedBox()
|
|
//floatingActionButton: FloatingSearchButton(),
|
|
);
|
|
}
|
|
|
|
buildAppLoaderWidget(bool isLoading) {
|
|
return isLoading ? AppLoaderWidget() : Container();
|
|
}
|
|
|
|
buildBodyWidget() {
|
|
// return body; //Stack(children: <Widget>[body, buildAppLoaderWidget(isLoading)]);
|
|
return Stack(children: <Widget>[
|
|
body,
|
|
isHelp?? Positioned(
|
|
|
|
child:Column(children: [
|
|
Container(
|
|
height:100,
|
|
width:150,
|
|
padding:EdgeInsets.all(5),
|
|
margin: EdgeInsets.only(right: 10.0, bottom: 0),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(10),
|
|
color: Colors.white,
|
|
boxShadow: [
|
|
BoxShadow(color: Colors.grey, spreadRadius: 3),
|
|
],
|
|
),
|
|
child: TyperAnimatedTextKit(
|
|
onTap: () {
|
|
|
|
},
|
|
text: [
|
|
"Discipline is the best tool",
|
|
"Design first, then code",
|
|
"Do not patch bugs out, rewrite them",
|
|
"Do not test bugs out, design them out",
|
|
],
|
|
textStyle: TextStyle(
|
|
fontSize: 14.0,
|
|
color:Colors.black54
|
|
|
|
),
|
|
speed:Duration(milliseconds: 100),
|
|
textAlign: TextAlign.start,
|
|
alignment: AlignmentDirectional.topStart // or Alignment.topLeft
|
|
)),
|
|
|
|
Positioned(child:Stack(children: [
|
|
Positioned(
|
|
top:0,
|
|
right:50,
|
|
|
|
child: Container(
|
|
|
|
height: 0,
|
|
width:0,
|
|
decoration: ShapeDecoration(
|
|
color: Colors.grey,
|
|
shape: MessageBorder(reverse: true),
|
|
))),
|
|
FloatingSearchButton()
|
|
],))
|
|
],), left:SizeConfig.screenWidth -160, bottom:50)
|
|
|
|
/*FloatingSearchButton()*/
|
|
]);
|
|
}
|
|
}
|