--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
// TODO: 4) _MyHomePageState Class
class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
// TODO: implement initState
super.initState();
this.getCompanyJsonData();
}
Future<String> this.getCompanyJsonData() async {
var response = await http.get(
Uri.encodeFull("https://secur****-company-api-*****/fx.jsp"),
headers: {'Accept': 'application/json'});
setState(() {
var resBody = json.decode(response.body);
currencyData = resBody[“alis”];
aAlis = currencyData["aalis"];
bAlis = currencyData[[“balis"];
cAlis = currencyData[“calis"];
});
return "Success!";
}
// TODO: BUILD WIDGET
@override
Widget build(BuildContext context) {
if (currencyData == null){
return new Center(
child: new CircularProgressIndicator(
backgroundColor: lightMainGreen,
)
);
} else if (aAlis != null) {
// redirect to Second Page
}
else if (bAlis != null) {
// redirect to Third Page
}
else if (cAlis != null) {
// redirect to Fourth Page
}
else {
return new Scaffold(
// APPBAR
// title: ,
appBar: new AppBar(
title: new Text(
trans(context, "main.appTitle"),
style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.w500),
),
//elevation: 1.0,
backgroundColor: midMainGreen,
),
// BODY
body: new Center(
child: new Text(‘No data found’),
),
);
}
} // build Widget
}
// TODO: 4) _MyHomePageState Class
class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
// TODO: implement initState
super.initState();
this.getCompanyJsonData();
}
Future<String> this.getCompanyJsonData() async {
var response = await http.get(
Uri.encodeFull("https://secur****-company-api-*****/fx.jsp"),
headers: {'Accept': 'application/json'});
aAlis = currencyData["aalis"];
setState(() {
var resBody = json.decode(response.body);
currencyData = resBody[“alis”];
bAlis = currencyData[[“balis"];
cAlis = currencyData[“calis"];
});
if (aAlis != null) {
Navigator
.of(context)
.push(new MaterialPageRoute(builder: (BuildContext context) {
return new AlisPage(...);
}));
--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
// TODO: BUILD WIDGET
@override
Widget build(BuildContext context) {
if (currencyData == null){
return new Center(
child: new CircularProgressIndicator(
backgroundColor: lightMainGreen,
)
);
} else if (aAlis != null) {
return secondPage();
}
else if (bAlis != null) {
return thirdPage();
}
else if (cAlis != null) {
return fourPage();
}
else {
return new Scaffold(
// APPBAR
// title: ,
appBar: new AppBar(
title: new Text(
trans(context, "main.appTitle"),
style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.w500),
),
//elevation: 1.0,
backgroundColor: midMainGreen,
),
// BODY
body: new Center(
child: new Text(‘No data found’),
),
);
}
} // build Widget
--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import 'package:flutter/material.dart';
class AlisPage extends StatefulWidget {
@override
_AlisPageState createState() => new _AlisPageState();
}
class _AlisPageState extends State<AlisPage> {
@override
Widget build(BuildContext context) {
return new Container(
child: new Text('Welcome to Second Page...'),
);
}
}
The main.dart:import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:navigator_capital/aalis.dart';
final Color darkMainGreen = const Color(0xFF689F38);
final Color midMainGreen = const Color(0xFF7CB342);
final Color lightMainGreen = const Color(0xFF8BC34A);
bool appLocaleSet;
Map companyData;
String aAlis;
// TODO: 1) MAIN **********************************************
void main() async {
runApp(new MyApp());
}
// TODO: 2) MyApp *********************************************
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
debugShowCheckedModeBanner: false,
title: "Company",
home: new MyHomePage(),
);
}
}
// TODO: 3) Statefull MyHomePage Class ************************
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
// TODO: 4) _MyHomePageState Class ****************************
class _MyHomePageState extends State<MyHomePage> {
@override
void initState() {
super.initState();
getCompanyJsonData();
}
Future<String> getCompanyJsonData() async {
var response = await http.get(
Uri.encodeFull("https://*******************************”),
headers: {'Accept': 'application/json'});
setState(() {
var resBody = json.decode(response.body);
companyData = resBody[“alis”];
aAlis = 'aalis';
});
return "Success!";
}
// TODO: BUILD WIDGET ******************************************
@override
Widget build(BuildContext context) {
if (companyData == null){
return new Center(
child: new CircularProgressIndicator(
backgroundColor: lightMainGreen,
)
);
} else if (aAlis != null) {
// redirect to Second Page
// ******* this is not work either ******************
// ******* the AlisPage is in aalis.dart ************
Navigator
.of(context)
.push(new MaterialPageRoute(builder: (BuildContext context){
Widget AlisPage() {
return new Scaffold(
body: new Center(
child: new Text("This is Second Page that returns"),
),
);
}
}));
}
else {
return new Scaffold(
// APPBAR
appBar: new AppBar(
title: new Text('Company'),
),
backgroundColor: midMainGreen,
// BODY
body: new Center(
child: new Text(’Showing the Json Data’),