add home screen and shipping addresses
This commit is contained in:
257
lib/pages/home_page_welcome.dart
Normal file
257
lib/pages/home_page_welcome.dart
Normal file
@@ -0,0 +1,257 @@
|
||||
import 'package:fcs/model/main_model.dart';
|
||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||
import 'package:fcs/widget/localization/transalation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:fcs/model/language_model.dart';
|
||||
|
||||
import 'package:fcs/pages/contact.dart';
|
||||
|
||||
import 'package:fcs/widget/banner.dart';
|
||||
import 'package:fcs/widget/localization/app_translations.dart';
|
||||
import 'package:fcs/widget/offline_redirect.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import '../theme/theme.dart';
|
||||
|
||||
import 'profile_page.dart';
|
||||
import 'signin_page.dart';
|
||||
|
||||
final msgLog = Logger('backgroundMessageHandler');
|
||||
|
||||
class HomePageWelcome extends StatefulWidget {
|
||||
@override
|
||||
_HomePageWelcomeState createState() => _HomePageWelcomeState();
|
||||
}
|
||||
|
||||
typedef BtnCallback();
|
||||
|
||||
class _HomePageWelcomeState extends State<HomePageWelcome> {
|
||||
final log = Logger('_HomePageWelcomeState');
|
||||
bool login = false;
|
||||
bool customer = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
int actualChart = 0;
|
||||
final numberFormatter = new NumberFormat("#,###");
|
||||
|
||||
String pin;
|
||||
List<bool> isSelected = [true, false];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
login = Provider.of<MainModel>(context).isLogin();
|
||||
|
||||
return OfflineRedirect(
|
||||
child: FlavorBanner(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
backgroundColor: primaryColor,
|
||||
title: ClipRRect(
|
||||
child: Image.asset("assets/logo.jpg", height: 40),
|
||||
borderRadius: new BorderRadius.circular(30.0),
|
||||
),
|
||||
actions: login
|
||||
? <Widget>[
|
||||
ToggleButtons(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'icons/flags/png/us.png',
|
||||
package: 'country_icons',
|
||||
fit: BoxFit.fitWidth,
|
||||
width: 25,
|
||||
),
|
||||
Image.asset(
|
||||
'icons/flags/png/mm.png',
|
||||
package: 'country_icons',
|
||||
fit: BoxFit.fitWidth,
|
||||
width: 25,
|
||||
)
|
||||
],
|
||||
onPressed: _langChange,
|
||||
isSelected: isSelected,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => Profile()),
|
||||
);
|
||||
},
|
||||
iconSize: 30,
|
||||
icon: Icon(Icons.account_circle),
|
||||
),
|
||||
]
|
||||
: <Widget>[
|
||||
ToggleButtons(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'icons/flags/png/us.png',
|
||||
package: 'country_icons',
|
||||
fit: BoxFit.fitWidth,
|
||||
width: 25,
|
||||
),
|
||||
Image.asset(
|
||||
'icons/flags/png/mm.png',
|
||||
package: 'country_icons',
|
||||
fit: BoxFit.fitWidth,
|
||||
width: 25,
|
||||
)
|
||||
],
|
||||
onPressed: _langChange,
|
||||
isSelected: isSelected,
|
||||
),
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context)
|
||||
.push(BottomUpPageRoute(SigninPage()));
|
||||
},
|
||||
// iconSize: 30,
|
||||
child: Text(
|
||||
"Sign In",
|
||||
style: siginButtonStyle,
|
||||
),
|
||||
),
|
||||
]),
|
||||
body: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient:
|
||||
// RadialGradient(
|
||||
// center: const Alignment(-0.7, 0.6), // near the top right
|
||||
// radius: 0.6,
|
||||
// colors: [
|
||||
// secondaryColor,
|
||||
// primaryColor, // yellow sun
|
||||
// ],
|
||||
// stops: [0.4, 1.0],
|
||||
// )
|
||||
LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment
|
||||
.bottomCenter, // 10% of the width, so there are ten blinds.
|
||||
colors: [
|
||||
Color(0xd0272262),
|
||||
Color(0xfa272262),
|
||||
// Color(0xa0ff4400),
|
||||
// secondaryColor,
|
||||
], // whitish to gray
|
||||
),
|
||||
// SweepGradient(
|
||||
// center: FractionalOffset.centerLeft,
|
||||
// startAngle: 0.0,
|
||||
// endAngle: math.pi * 2,
|
||||
// colors: const <Color>[
|
||||
// secondaryColor,
|
||||
// primaryColor,
|
||||
// secondaryColor,
|
||||
// primaryColor,
|
||||
// secondaryColor,
|
||||
// ],
|
||||
// stops: const <double>[0.0, 0.25, 0.5, 0.75, 1.0],
|
||||
// ),
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: ListView(children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 50),
|
||||
child: CircleAvatar(
|
||||
radius: (50),
|
||||
backgroundColor: Colors.white,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
child: Image.asset("assets/logo.jpg"),
|
||||
)),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Text(
|
||||
"Welcome Cargo Services\nby FCS Trading",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontFamily: "Roboto"),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
]),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
// _buildSmallButton(
|
||||
// "Policies", FontAwesomeIcons.fileContract),
|
||||
_buildSmallButton(
|
||||
"Contact Us", SimpleLineIcons.support),
|
||||
],
|
||||
)
|
||||
],
|
||||
))),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_langChange(index) {
|
||||
var languageModel = Provider.of<LanguageModel>(context);
|
||||
languageModel.saveLanguage(Translation().supportedLanguages[index]);
|
||||
setState(() {
|
||||
isSelected.asMap().forEach((i, e) {
|
||||
isSelected[i] = false;
|
||||
});
|
||||
isSelected[index] = !isSelected[index];
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildSmallButton(String text, IconData iconData) {
|
||||
return InkWell(
|
||||
onTap: () => {
|
||||
Navigator.of(context)
|
||||
.push(MaterialPageRoute(builder: (_) => Contact())),
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(18.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(iconData, color: Colors.white70),
|
||||
color: Colors.white70,
|
||||
onPressed: null),
|
||||
// RaisedButton(onPressed: ()=>{},child: Row(
|
||||
// children: <Widget>[
|
||||
// IconButton(
|
||||
// icon: Icon(iconData, ),
|
||||
// onPressed: null),
|
||||
// Text(text),
|
||||
// ],
|
||||
// ),color: Colors.transparent,
|
||||
// focusColor: Colors.transparent,),
|
||||
Text(
|
||||
text,
|
||||
style: subMenuStyle,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user