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
// "estoy usando el diccionario de flutter" | |
import 'package:flutter/material.dart'; | |
//main:arrancar Indica la acción inicial de la app | |
//=> "lo qué" Para una sola cosa. En este caso, arranca runApp (la aplicacion) de nombre MyApp | |
//extends se usa para ampliar lo que hay dentro. MyApp: un Widget. extends lo que hay dentro de ese Widget | |
void main() => runApp(MyApp()); | |
//build construir, para crear lo que hay dentro de MyApp. Aquí está el esquema general de la app: tema, color principal (el de appbar) y páginas que conntiene. En este caso, solo "Home" | |
class MyApp extends StatelessWidget { | |
@override |
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_local_notifications/flutter_local_notifications.dart'; | |
// ... | |
class AppModel extends Model { | |
static final FlutterLocalNotificationsPlugin _notifications = | |
FlutterLocalNotificationsPlugin(); | |
// ... | |
FlutterLocalNotificationsPlugin get notifications => _notifications; |
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( |
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
<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
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
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
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
// 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
@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>[ | |
// ... |
NewerOlder