Created
June 4, 2018 19:31
-
-
Save nathansamson/a1f9aa15d2c607093e2cf8d82480d39b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file contains the fastlane.tools configuration | |
# You can find the documentation at https://docs.fastlane.tools | |
# | |
# For a list of all available actions, check out | |
# | |
# https://docs.fastlane.tools/actions | |
# | |
# For a list of all available plugins, check out | |
# | |
# https://docs.fastlane.tools/plugins/available-plugins | |
# | |
# Uncomment the line if you want fastlane to automatically update itself | |
# update_fastlane | |
default_platform(:android) | |
platform :android do | |
desc "Runs all the tests" | |
lane :test do | |
gradle(task: "test") | |
end | |
desc "Submit a new Beta Build to Google Play (beta track)" | |
lane :beta do | |
gradle(task: "clean assembleRelease") | |
upload_to_play_store(track: 'beta', | |
apk: '../build/app/outputs/apk/release/app-release.apk', | |
json_key_data: Base64.decode64(ENV['GOOGLE_PLAY_JSON'])) | |
# sh "your_script.sh" | |
# You can also use other beta testing services here | |
end | |
desc "Generate new icons" | |
lane :icons do | |
android_appicon( | |
appicon_image_file: 'master-launcher-icon.jpg', | |
appicon_icon_types: [:launcher], | |
appicon_path: 'app/src/main/res/mipmap' | |
) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'dart:async'; | |
import 'dart:convert'; | |
void main() => runApp(new MyApp()); | |
class Complex { | |
String name; | |
int id; | |
Complex(String name, int id) { | |
this.name = name; | |
this.id = id; | |
} | |
factory Complex.fromJson(Map<String, dynamic> json) { | |
return new Complex( | |
json['title'], | |
json['id'] | |
); | |
} | |
} | |
Future<List<Complex>> getAllComplexes(String language) async { | |
var list = new List<Complex>(); | |
final response = """ | |
{ | |
"complexes": [ | |
{ | |
"title": "A", | |
"id": 21 | |
}, | |
{ | |
"title": "B", | |
"id": 2 | |
} | |
] | |
} | |
"""; | |
final responseJson = json.decode(response); | |
for (var element in responseJson['complexes']) { | |
list.add(Complex.fromJson(element)); | |
} | |
return list; | |
} | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
title: 'Example', | |
theme: new ThemeData( | |
// This is the theme of your application. | |
// | |
// Try running your application with "flutter run". You'll see the | |
// application has a blue toolbar. Then, without quitting the app, try | |
// changing the primarySwatch below to Colors.green and then invoke | |
// "hot reload" (press "r" in the console where you ran "flutter run", | |
// or press Run > Flutter Hot Reload in IntelliJ). Notice that the | |
// counter didn't reset back to zero; the application is not restarted. | |
primarySwatch: Colors.blue, | |
), | |
home: new MyHomePage(title: 'Example'), | |
); | |
} | |
} | |
class MyHomePage extends StatefulWidget { | |
MyHomePage({Key key, this.title}) : super(key: key); | |
// This widget is the home page of your application. It is stateful, meaning | |
// that it has a State object (defined below) that contains fields that affect | |
// how it looks. | |
// This class is the configuration for the state. It holds the values (in this | |
// case the title) provided by the parent (in this case the App widget) and | |
// used by the build method of the State. Fields in a Widget subclass are | |
// always marked "final". | |
final String title; | |
@override | |
_MyHomePageState createState() => new _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
@override | |
Widget build(BuildContext context) { | |
// This method is rerun every time setState is called, for instance as done | |
// by the _incrementCounter method above. | |
// | |
// The Flutter framework has been optimized to make rerunning build methods | |
// fast, so that you can just rebuild anything that needs updating rather | |
// than having to individually change instances of widgets. | |
return new Scaffold( | |
appBar: new AppBar( | |
// Here we take the value from the MyHomePage object that was created by | |
// the App.build method, and use it to set our appbar title. | |
title: new Text(widget.title), | |
), | |
body: new Center( | |
// Center is a layout widget. It takes a single child and positions it | |
// in the middle of the parent. | |
child: new FutureBuilder<List<Complex>>( | |
future: getAllComplexes('nl'), | |
builder: (context, snapshot) { | |
if (snapshot.hasData) { | |
return new ListView( | |
children: new List<Widget>.from(snapshot.data.map<Widget>((Complex c) { | |
return new ListTile( | |
title: new Text(c.name) | |
); | |
})), | |
); | |
} else if (snapshot.hasError) { | |
return new Text("${snapshot.error}"); | |
} | |
// By default, show a loading spinner | |
return new CircularProgressIndicator(); | |
}, | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment