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
class LaunchpadModel extends QuerryModel { | |
final String id, name; | |
LaunchpadModel(this.id, this.name); | |
@override | |
Future loadData() async { | |
// Get item by http call | |
response = await http.get(Url.launchpadDialog + id); |
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 'dart:async'; | |
import 'package:scoped_model/scoped_model.dart'; | |
/// QUERRY MODEL | |
/// General model used to help retrieve, parse & storage | |
/// information from a public API | |
abstract class QuerryModel extends Model { | |
List _items = List(); | |
List _photos = List(); |
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
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: CustomScrollView(slivers: <Widget>[ | |
SliverAppBar( | |
expandedHeight: MediaQuery.of(context).size.height * 0.3, | |
floating: false, | |
pinned: true, | |
actions: <Widget>[ | |
// ... |
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
// assets/flutter_i18n/en.json | |
// { | |
// "foo": { | |
// "bar": "Sample", | |
// // ... | |
// }, | |
// // ... | |
// } | |
Text( |
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
return CachedNetworkImage( | |
imageUrl: url, | |
errorWidget: Icon( | |
Icons.cancel, | |
size: 32.0, | |
color: Theme.of(context).textTheme.caption.color, | |
), | |
fadeInDuration: Duration(milliseconds: 100), | |
fit: BoxFit.cover, | |
); |
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
searchLaunches(BuildContext context, List list) { | |
return MaterialPageRoute<Launch>( | |
builder: (context) => Material( | |
child: MaterialSearch<Launch>( | |
barBackgroundColor: Theme.of(context).primaryColor, | |
iconColor: Colors.white, | |
placeholder: FlutterI18n.translate( | |
context, | |
'spacex.other.tooltip.search', | |
), |
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
dependencies: | |
flutter: | |
sdk: flutter | |
... | |
flutter_local_notifications: ^0.6.1 |
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
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.example.example"> | |
<uses-permission android:name="android.permission.INTERNET"/> | |
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> | |
<application> | |
<activity> | |
... | |
</activity> |
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
Future initNotifications(BuildContext context) async { | |
bool updateNotifications; | |
final SharedPreferences prefs = await SharedPreferences.getInstance(); | |
// Checks if is necessary to update scheduled notifications | |
try { | |
updateNotifications = | |
prefs.getString('notifications.launches.upcoming') != | |
launch.launchDate.toIso8601String(); | |
} catch (e) { |
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
Future _scheduleNotification({ | |
BuildContext context, | |
int id, | |
String time, | |
Duration subtract, | |
}) async { | |
await ScopedModel.of<AppModel>(context).notifications.schedule( | |
id, | |
FlutterI18n.translate(context, 'spacex.notifications.launches.title'), | |
FlutterI18n.translate( |
OlderNewer