mirror of
https://github.com/flutter/samples.git
synced 2025-11-09 06:18:49 +00:00
Updates veggieseasons to Dart 2.3, adds some minor UI updates (#88)
This commit is contained in:
@@ -17,6 +17,6 @@ SPEC CHECKSUMS:
|
|||||||
Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a
|
Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a
|
||||||
shared_preferences: 1feebfa37bb57264736e16865e7ffae7fc99b523
|
shared_preferences: 1feebfa37bb57264736e16865e7ffae7fc99b523
|
||||||
|
|
||||||
PODFILE CHECKSUM: aff02bfeed411c636180d6812254b2daeea14d09
|
PODFILE CHECKSUM: e8988baac3a50f787b9d3ed7ca44957b442f92a7
|
||||||
|
|
||||||
COCOAPODS: 1.6.1
|
COCOAPODS: 1.7.0
|
||||||
|
|||||||
@@ -56,6 +56,7 @@
|
|||||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
9AC24389CA19ECD679B522EE /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||||
BA0A9C772FFC1878911ECDBC /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
BA0A9C772FFC1878911ECDBC /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
@@ -134,6 +135,7 @@
|
|||||||
children = (
|
children = (
|
||||||
BA0A9C772FFC1878911ECDBC /* Pods-Runner.debug.xcconfig */,
|
BA0A9C772FFC1878911ECDBC /* Pods-Runner.debug.xcconfig */,
|
||||||
44D0F7D543E9A9D5B9AF94AC /* Pods-Runner.release.xcconfig */,
|
44D0F7D543E9A9D5B9AF94AC /* Pods-Runner.release.xcconfig */,
|
||||||
|
9AC24389CA19ECD679B522EE /* Pods-Runner.profile.xcconfig */,
|
||||||
);
|
);
|
||||||
name = Pods;
|
name = Pods;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|||||||
@@ -227,6 +227,15 @@ class LocalVeggieProvider {
|
|||||||
],
|
],
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
|
Trivia(
|
||||||
|
'The first evidence of avocado consumption by humans dates back to what year?',
|
||||||
|
[
|
||||||
|
'2,000 B.C.',
|
||||||
|
'6,000 B.C.',
|
||||||
|
'10,000 B.C.',
|
||||||
|
],
|
||||||
|
2,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Veggie(
|
Veggie(
|
||||||
@@ -371,6 +380,15 @@ class LocalVeggieProvider {
|
|||||||
],
|
],
|
||||||
0,
|
0,
|
||||||
),
|
),
|
||||||
|
Trivia(
|
||||||
|
'Green cauliflower is sometimes called what?',
|
||||||
|
[
|
||||||
|
'Broccoflower',
|
||||||
|
'Avocadoflower',
|
||||||
|
'Gross',
|
||||||
|
],
|
||||||
|
0,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Veggie(
|
Veggie(
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ class ServingInfoChart extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 16.0),
|
SizedBox(height: 16),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 9.0,
|
left: 9,
|
||||||
bottom: 4.0,
|
bottom: 4,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'Serving info',
|
'Serving info',
|
||||||
@@ -60,7 +60,7 @@ class ServingInfoChart extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: Styles.servingInfoBorderColor),
|
border: Border.all(color: Styles.servingInfoBorderColor),
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Table(
|
Table(
|
||||||
@@ -134,7 +134,7 @@ class ServingInfoChart extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 16.0),
|
padding: const EdgeInsets.only(top: 16),
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: prefs.desiredCalories,
|
future: prefs.desiredCalories,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
@@ -164,24 +164,8 @@ class InfoView extends StatelessWidget {
|
|||||||
final prefs = ScopedModel.of<Preferences>(context, rebuildOnChange: true);
|
final prefs = ScopedModel.of<Preferences>(context, rebuildOnChange: true);
|
||||||
final veggie = appState.getVeggie(id);
|
final veggie = appState.getVeggie(id);
|
||||||
|
|
||||||
final seasonIcons = <Widget>[];
|
|
||||||
|
|
||||||
for (Season season in veggie.seasons) {
|
|
||||||
seasonIcons.addAll([
|
|
||||||
SizedBox(width: 12.0),
|
|
||||||
Padding(
|
|
||||||
padding: Styles.seasonIconPadding[season],
|
|
||||||
child: Icon(
|
|
||||||
Styles.seasonIconData[season],
|
|
||||||
semanticLabel: seasonNames[season],
|
|
||||||
color: Styles.seasonColors[season],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(24.0),
|
padding: const EdgeInsets.all(24),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
@@ -201,20 +185,31 @@ class InfoView extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
]..addAll(seasonIcons),
|
for (Season season in veggie.seasons) ...[
|
||||||
|
SizedBox(width: 12),
|
||||||
|
Padding(
|
||||||
|
padding: Styles.seasonIconPadding[season],
|
||||||
|
child: Icon(
|
||||||
|
Styles.seasonIconData[season],
|
||||||
|
semanticLabel: seasonNames[season],
|
||||||
|
color: Styles.seasonColors[season],
|
||||||
),
|
),
|
||||||
SizedBox(height: 8.0),
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
veggie.name,
|
veggie.name,
|
||||||
style: Styles.detailsTitleText,
|
style: Styles.detailsTitleText,
|
||||||
),
|
),
|
||||||
SizedBox(height: 8.0),
|
SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
veggie.shortDescription,
|
veggie.shortDescription,
|
||||||
style: Styles.detailsDescriptionText,
|
style: Styles.detailsDescriptionText,
|
||||||
),
|
),
|
||||||
ServingInfoChart(veggie, prefs),
|
ServingInfoChart(veggie, prefs),
|
||||||
SizedBox(height: 24.0),
|
SizedBox(height: 24),
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
@@ -224,7 +219,7 @@ class InfoView extends StatelessWidget {
|
|||||||
appState.setFavorite(id, value);
|
appState.setFavorite(id, value);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: 8.0),
|
SizedBox(width: 8),
|
||||||
Text('Save to Garden'),
|
Text('Save to Garden'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -250,12 +245,12 @@ class _DetailsScreenState extends State<DetailsScreen> {
|
|||||||
final veggie = model.getVeggie(widget.id);
|
final veggie = model.getVeggie(widget.id);
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 150.0,
|
height: 150,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
right: 0.0,
|
right: 0,
|
||||||
left: 0.0,
|
left: 0,
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
veggie.imageAssetPath,
|
veggie.imageAssetPath,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
@@ -263,8 +258,8 @@ class _DetailsScreenState extends State<DetailsScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 16.0,
|
top: 16,
|
||||||
left: 16.0,
|
left: 16,
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: CloseButton(() {
|
child: CloseButton(() {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
|||||||
@@ -11,49 +11,35 @@ import 'package:veggieseasons/styles.dart';
|
|||||||
import 'package:veggieseasons/widgets/veggie_headline.dart';
|
import 'package:veggieseasons/widgets/veggie_headline.dart';
|
||||||
|
|
||||||
class FavoritesScreen extends StatelessWidget {
|
class FavoritesScreen extends StatelessWidget {
|
||||||
/// Builds the "content" of the favorites screen: either a list of favorite
|
|
||||||
/// veggies or a note that says the user hasn't favorited any yet.
|
|
||||||
Widget _buildTabViewBody(BuildContext context) {
|
|
||||||
final model = ScopedModel.of<AppState>(context, rebuildOnChange: true);
|
|
||||||
|
|
||||||
if (model.favoriteVeggies.length == 0) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
|
||||||
child: Text(
|
|
||||||
'You haven\'t added any favorite veggies to your garden yet.',
|
|
||||||
style: Styles.headlineDescription,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final rows = <Widget>[
|
|
||||||
SizedBox(height: 24.0),
|
|
||||||
];
|
|
||||||
|
|
||||||
for (Veggie veggie in model.favoriteVeggies) {
|
|
||||||
rows.add(
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 24.0),
|
|
||||||
child: VeggieHeadline(veggie),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ListView(
|
|
||||||
children: rows,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoTabView(
|
return CupertinoTabView(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
|
final model = ScopedModel.of<AppState>(context, rebuildOnChange: true);
|
||||||
|
|
||||||
return CupertinoPageScaffold(
|
return CupertinoPageScaffold(
|
||||||
navigationBar: CupertinoNavigationBar(
|
navigationBar: CupertinoNavigationBar(
|
||||||
middle: Text('My Garden'),
|
middle: Text('My Garden'),
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: _buildTabViewBody(context),
|
child: model.favoriteVeggies.isEmpty
|
||||||
|
? Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||||
|
child: Text(
|
||||||
|
'You haven\'t added any favorite veggies to your garden yet.',
|
||||||
|
style: Styles.headlineDescription,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView(
|
||||||
|
children: [
|
||||||
|
SizedBox(height: 24),
|
||||||
|
for (Veggie veggie in model.favoriteVeggies)
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.fromLTRB(16, 0, 16, 24),
|
||||||
|
child: VeggieHeadline(veggie),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,24 +13,16 @@ import 'package:veggieseasons/styles.dart';
|
|||||||
import 'package:veggieseasons/widgets/veggie_card.dart';
|
import 'package:veggieseasons/widgets/veggie_card.dart';
|
||||||
|
|
||||||
class ListScreen extends StatelessWidget {
|
class ListScreen extends StatelessWidget {
|
||||||
List<Widget> _generateVeggieRows(List<Veggie> veggies, Preferences prefs,
|
Widget _generateVeggieRow(veggie, Preferences prefs, {bool inSeason = true}) {
|
||||||
{bool inSeason = true}) {
|
return Padding(
|
||||||
final cards = List<Widget>();
|
padding: EdgeInsets.only(left: 16, right: 16, bottom: 24),
|
||||||
|
|
||||||
for (Veggie veggie in veggies) {
|
|
||||||
cards.add(Padding(
|
|
||||||
padding: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 24.0),
|
|
||||||
child: FutureBuilder<Set<VeggieCategory>>(
|
child: FutureBuilder<Set<VeggieCategory>>(
|
||||||
future: prefs.preferredCategories,
|
future: prefs.preferredCategories,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final data = snapshot.data ?? Set<VeggieCategory>();
|
final data = snapshot.data ?? Set<VeggieCategory>();
|
||||||
return VeggieCard(
|
return VeggieCard(veggie, inSeason, data.contains(veggie.category));
|
||||||
veggie, inSeason, data.contains(veggie.category));
|
|
||||||
}),
|
}),
|
||||||
));
|
);
|
||||||
}
|
|
||||||
|
|
||||||
return cards;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -38,16 +30,20 @@ class ListScreen extends StatelessWidget {
|
|||||||
return CupertinoTabView(
|
return CupertinoTabView(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
String dateString = DateFormat("MMMM y").format(DateTime.now());
|
String dateString = DateFormat("MMMM y").format(DateTime.now());
|
||||||
|
|
||||||
final appState =
|
final appState =
|
||||||
ScopedModel.of<AppState>(context, rebuildOnChange: true);
|
ScopedModel.of<AppState>(context, rebuildOnChange: true);
|
||||||
final prefs =
|
final prefs =
|
||||||
ScopedModel.of<Preferences>(context, rebuildOnChange: true);
|
ScopedModel.of<Preferences>(context, rebuildOnChange: true);
|
||||||
|
|
||||||
final rows = <Widget>[];
|
return DecoratedBox(
|
||||||
|
decoration: BoxDecoration(color: Color(0xffffffff)),
|
||||||
rows.add(
|
child: ListView.builder(
|
||||||
Padding(
|
itemCount: appState.allVeggies.length + 2,
|
||||||
padding: const EdgeInsets.fromLTRB(16.0, 24.0, 16.0, 16.0),
|
itemBuilder: (context, index) {
|
||||||
|
if (index == 0) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(16, 24, 16, 16),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@@ -55,25 +51,25 @@ class ListScreen extends StatelessWidget {
|
|||||||
Text('In season today', style: Styles.headlineText),
|
Text('In season today', style: Styles.headlineText),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
} else if (index <= appState.availableVeggies.length) {
|
||||||
rows.addAll(_generateVeggieRows(appState.availableVeggies, prefs));
|
return _generateVeggieRow(
|
||||||
|
appState.availableVeggies[index - 1],
|
||||||
rows.add(
|
prefs,
|
||||||
Padding(
|
);
|
||||||
padding: const EdgeInsets.fromLTRB(16.0, 24.0, 16.0, 16.0),
|
} else if (index <= appState.availableVeggies.length + 1) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(16, 24, 16, 16),
|
||||||
child: Text('Not in season', style: Styles.headlineText),
|
child: Text('Not in season', style: Styles.headlineText),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
rows.addAll(_generateVeggieRows(appState.unavailableVeggies, prefs,
|
int relativeIndex =
|
||||||
inSeason: false));
|
index - (appState.availableVeggies.length + 2);
|
||||||
|
return _generateVeggieRow(
|
||||||
return DecoratedBox(
|
appState.unavailableVeggies[relativeIndex], prefs,
|
||||||
decoration: BoxDecoration(color: Color(0xffffffff)),
|
inSeason: false);
|
||||||
child: ListView(
|
}
|
||||||
children: rows,
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class _SearchScreenState extends State<SearchScreen> {
|
|||||||
|
|
||||||
Widget _createSearchBox() {
|
Widget _createSearchBox() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8),
|
||||||
child: SearchBar(
|
child: SearchBar(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
@@ -51,7 +51,7 @@ class _SearchScreenState extends State<SearchScreen> {
|
|||||||
if (veggies.isEmpty) {
|
if (veggies.isEmpty) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||||
child: Text(
|
child: Text(
|
||||||
'No veggies matching your search terms were found.',
|
'No veggies matching your search terms were found.',
|
||||||
style: Styles.headlineDescription,
|
style: Styles.headlineDescription,
|
||||||
@@ -64,7 +64,7 @@ class _SearchScreenState extends State<SearchScreen> {
|
|||||||
itemCount: veggies.length,
|
itemCount: veggies.length,
|
||||||
itemBuilder: (context, i) {
|
itemBuilder: (context, i) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 24.0),
|
padding: EdgeInsets.only(left: 16, right: 16, bottom: 24),
|
||||||
child: VeggieHeadline(veggies[i]),
|
child: VeggieHeadline(veggies[i]),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class SettingsScreen extends StatelessWidget {
|
|||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
Text(snapshot.data?.toString() ?? ''),
|
Text(snapshot.data?.toString() ?? ''),
|
||||||
SizedBox(width: 8.0),
|
SizedBox(width: 8),
|
||||||
SettingsNavigationIndicator(),
|
SettingsNavigationIndicator(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,15 +11,15 @@ abstract class Styles {
|
|||||||
static const headlineText = TextStyle(
|
static const headlineText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.8),
|
color: Color.fromRGBO(0, 0, 0, 0.8),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 32.0,
|
fontSize: 32,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
);
|
);
|
||||||
|
|
||||||
static const minorText = TextStyle(
|
static const minorText = TextStyle(
|
||||||
color: Color.fromRGBO(128, 128, 128, 1.0),
|
color: Color.fromRGBO(128, 128, 128, 1),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
);
|
);
|
||||||
@@ -27,7 +27,7 @@ abstract class Styles {
|
|||||||
static const headlineName = TextStyle(
|
static const headlineName = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 24.0,
|
fontSize: 24,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
);
|
);
|
||||||
@@ -35,7 +35,7 @@ abstract class Styles {
|
|||||||
static const headlineDescription = TextStyle(
|
static const headlineDescription = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.8),
|
color: Color.fromRGBO(0, 0, 0, 0.8),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
);
|
);
|
||||||
@@ -43,7 +43,7 @@ abstract class Styles {
|
|||||||
static const cardTitleText = TextStyle(
|
static const cardTitleText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 32.0,
|
fontSize: 32,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
);
|
);
|
||||||
@@ -51,7 +51,7 @@ abstract class Styles {
|
|||||||
static const cardCategoryText = TextStyle(
|
static const cardCategoryText = TextStyle(
|
||||||
color: Color.fromRGBO(255, 255, 255, 0.9),
|
color: Color.fromRGBO(255, 255, 255, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
);
|
);
|
||||||
@@ -59,7 +59,7 @@ abstract class Styles {
|
|||||||
static const cardDescriptionText = TextStyle(
|
static const cardDescriptionText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
);
|
);
|
||||||
@@ -67,7 +67,7 @@ abstract class Styles {
|
|||||||
static const detailsTitleText = TextStyle(
|
static const detailsTitleText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 30.0,
|
fontSize: 30,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
);
|
);
|
||||||
@@ -75,7 +75,7 @@ abstract class Styles {
|
|||||||
static const detailsPreferredCategoryText = TextStyle(
|
static const detailsPreferredCategoryText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 80, 0, 0.7),
|
color: Color.fromRGBO(0, 80, 0, 0.7),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
);
|
);
|
||||||
@@ -83,7 +83,7 @@ abstract class Styles {
|
|||||||
static const detailsCategoryText = TextStyle(
|
static const detailsCategoryText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.7),
|
color: Color.fromRGBO(0, 0, 0, 0.7),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
);
|
);
|
||||||
@@ -91,7 +91,7 @@ abstract class Styles {
|
|||||||
static const detailsDescriptionText = TextStyle(
|
static const detailsDescriptionText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
);
|
);
|
||||||
@@ -99,15 +99,15 @@ abstract class Styles {
|
|||||||
static const detailsBoldDescriptionText = TextStyle(
|
static const detailsBoldDescriptionText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
);
|
);
|
||||||
|
|
||||||
static const detailsServingHeaderText = TextStyle(
|
static const detailsServingHeaderText = TextStyle(
|
||||||
color: Color.fromRGBO(176, 176, 176, 1.0),
|
color: Color.fromRGBO(176, 176, 176, 1),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
);
|
);
|
||||||
@@ -115,7 +115,7 @@ abstract class Styles {
|
|||||||
static const detailsServingLabelText = TextStyle(
|
static const detailsServingLabelText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
);
|
);
|
||||||
@@ -123,7 +123,7 @@ abstract class Styles {
|
|||||||
static const detailsServingValueText = TextStyle(
|
static const detailsServingValueText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
);
|
);
|
||||||
@@ -131,7 +131,7 @@ abstract class Styles {
|
|||||||
static const detailsServingNoteText = TextStyle(
|
static const detailsServingNoteText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
);
|
);
|
||||||
@@ -139,7 +139,7 @@ abstract class Styles {
|
|||||||
static const triviaFinishedTitleText = TextStyle(
|
static const triviaFinishedTitleText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 32.0,
|
fontSize: 32,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
);
|
);
|
||||||
@@ -147,7 +147,7 @@ abstract class Styles {
|
|||||||
static const triviaFinishedText = TextStyle(
|
static const triviaFinishedText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 16.0,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
);
|
);
|
||||||
@@ -155,7 +155,7 @@ abstract class Styles {
|
|||||||
static const triviaFinishedBigText = TextStyle(
|
static const triviaFinishedBigText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 0.9),
|
color: Color.fromRGBO(0, 0, 0, 0.9),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 48.0,
|
fontSize: 48,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
);
|
);
|
||||||
@@ -173,16 +173,16 @@ abstract class Styles {
|
|||||||
static const closeButtonPressed = Color(0xff808080);
|
static const closeButtonPressed = Color(0xff808080);
|
||||||
|
|
||||||
static const TextStyle searchText = TextStyle(
|
static const TextStyle searchText = TextStyle(
|
||||||
color: Color.fromRGBO(0, 0, 0, 1.0),
|
color: Color.fromRGBO(0, 0, 0, 1),
|
||||||
fontFamily: 'NotoSans',
|
fontFamily: 'NotoSans',
|
||||||
fontSize: 14.0,
|
fontSize: 14,
|
||||||
fontStyle: FontStyle.normal,
|
fontStyle: FontStyle.normal,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
);
|
);
|
||||||
|
|
||||||
static const Color searchCursorColor = Color.fromRGBO(0, 122, 255, 1.0);
|
static const Color searchCursorColor = Color.fromRGBO(0, 122, 255, 1);
|
||||||
|
|
||||||
static const Color searchIconColor = Color.fromRGBO(128, 128, 128, 1.0);
|
static const Color searchIconColor = Color.fromRGBO(128, 128, 128, 1);
|
||||||
|
|
||||||
static const seasonColors = <Season, Color>{
|
static const seasonColors = <Season, Color>{
|
||||||
Season.winter: Color(0xff336dcc),
|
Season.winter: Color(0xff336dcc),
|
||||||
@@ -194,10 +194,10 @@ abstract class Styles {
|
|||||||
// While handy, some of the Font Awesome icons sometimes bleed over their
|
// While handy, some of the Font Awesome icons sometimes bleed over their
|
||||||
// allotted bounds. This padding is used to adjust for that.
|
// allotted bounds. This padding is used to adjust for that.
|
||||||
static const seasonIconPadding = {
|
static const seasonIconPadding = {
|
||||||
Season.winter: const EdgeInsets.only(right: 0.0),
|
Season.winter: const EdgeInsets.only(right: 0),
|
||||||
Season.spring: const EdgeInsets.only(right: 4.0),
|
Season.spring: const EdgeInsets.only(right: 4),
|
||||||
Season.summer: const EdgeInsets.only(right: 6.0),
|
Season.summer: const EdgeInsets.only(right: 6),
|
||||||
Season.autumn: const EdgeInsets.only(right: 0.0),
|
Season.autumn: const EdgeInsets.only(right: 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const seasonIconData = {
|
static const seasonIconData = {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class FrostedBox extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BackdropFilter(
|
return BackdropFilter(
|
||||||
filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
|
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
|
||||||
child: DecoratedBox(
|
child: DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Styles.frostedBackground,
|
color: Styles.frostedBackground,
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ class SearchBar extends StatelessWidget {
|
|||||||
return DecoratedBox(
|
return DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Styles.searchBackground,
|
color: Styles.searchBackground,
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
borderRadius: BorderRadius.circular(10),
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 4.0,
|
horizontal: 4,
|
||||||
vertical: 8.0,
|
vertical: 8,
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ class SettingsGroupHeader extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
left: 15.0,
|
left: 15,
|
||||||
right: 15.0,
|
right: 15,
|
||||||
bottom: 6.0,
|
bottom: 6,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
title.toUpperCase(),
|
title.toUpperCase(),
|
||||||
@@ -47,15 +47,15 @@ class SettingsGroupFooter extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
left: 15.0,
|
left: 15,
|
||||||
right: 15.0,
|
right: 15,
|
||||||
top: 7.5,
|
top: 7.5,
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
title,
|
title,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Styles.settingsGroupSubtitle,
|
color: Styles.settingsGroupSubtitle,
|
||||||
fontSize: 13.0,
|
fontSize: 13,
|
||||||
letterSpacing: -0.08,
|
letterSpacing: -0.08,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -87,24 +87,25 @@ class SettingsGroup extends StatelessWidget {
|
|||||||
dividedItems.add(items[i]);
|
dividedItems.add(items[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Widget> columnChildren = [];
|
return Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
if (header != null) {
|
top: header == null ? 35 : 22,
|
||||||
columnChildren.add(header);
|
),
|
||||||
}
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
columnChildren.add(
|
children: [
|
||||||
|
if (header != null) header,
|
||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: CupertinoColors.white,
|
color: CupertinoColors.white,
|
||||||
border: Border(
|
border: Border(
|
||||||
top: const BorderSide(
|
top: const BorderSide(
|
||||||
color: Styles.settingsLineation,
|
color: Styles.settingsLineation,
|
||||||
width: 0.0,
|
width: 0,
|
||||||
),
|
),
|
||||||
bottom: const BorderSide(
|
bottom: const BorderSide(
|
||||||
color: Styles.settingsLineation,
|
color: Styles.settingsLineation,
|
||||||
width: 0.0,
|
width: 0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -113,19 +114,8 @@ class SettingsGroup extends StatelessWidget {
|
|||||||
children: dividedItems,
|
children: dividedItems,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
if (footer != null) footer,
|
||||||
|
],
|
||||||
if (footer != null) {
|
|
||||||
columnChildren.add(footer);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: header == null ? 35.0 : 22.0,
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: columnChildren,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class SettingsNavigationIndicator extends StatelessWidget {
|
|||||||
return Icon(
|
return Icon(
|
||||||
CupertinoIcons.forward,
|
CupertinoIcons.forward,
|
||||||
color: Styles.settingsMediumGray,
|
color: Styles.settingsMediumGray,
|
||||||
size: 21.0,
|
size: 21,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,14 +45,14 @@ class SettingsIcon extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(5.0),
|
borderRadius: BorderRadius.circular(5),
|
||||||
color: backgroundColor,
|
color: backgroundColor,
|
||||||
),
|
),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Icon(
|
child: Icon(
|
||||||
icon,
|
icon,
|
||||||
color: foregroundColor,
|
color: foregroundColor,
|
||||||
size: 20.0,
|
size: 20,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -85,67 +85,6 @@ class SettingsItemState extends State<SettingsItem> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
List<Widget> rowChildren = [];
|
|
||||||
|
|
||||||
if (widget.icon != null) {
|
|
||||||
rowChildren.add(
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
left: 15.0,
|
|
||||||
bottom: 2.0,
|
|
||||||
),
|
|
||||||
child: SizedBox(
|
|
||||||
height: 29.0,
|
|
||||||
width: 29.0,
|
|
||||||
child: widget.icon,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget titleSection;
|
|
||||||
|
|
||||||
if (widget.subtitle == null) {
|
|
||||||
titleSection = Padding(
|
|
||||||
padding: EdgeInsets.only(top: 1.5),
|
|
||||||
child: Text(widget.label),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
titleSection = Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
SizedBox(height: 8.5),
|
|
||||||
Text(widget.label),
|
|
||||||
SizedBox(height: 4.0),
|
|
||||||
Text(
|
|
||||||
widget.subtitle,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12.0,
|
|
||||||
letterSpacing: -0.2,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
rowChildren.add(
|
|
||||||
Expanded(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
left: 15.0,
|
|
||||||
),
|
|
||||||
child: titleSection,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
rowChildren.add(
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(right: 11.0),
|
|
||||||
child: widget.content ?? Container(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return AnimatedContainer(
|
return AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 200),
|
duration: const Duration(milliseconds: 200),
|
||||||
color: pressed ? Styles.settingsItemPressed : Styles.transparentColor,
|
color: pressed ? Styles.settingsItemPressed : Styles.transparentColor,
|
||||||
@@ -168,9 +107,53 @@ class SettingsItemState extends State<SettingsItem> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: widget.subtitle == null ? 44.0 : 57.0,
|
height: widget.subtitle == null ? 44 : 57,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: rowChildren,
|
children: [
|
||||||
|
if (widget.icon != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 15,
|
||||||
|
bottom: 2,
|
||||||
|
),
|
||||||
|
child: SizedBox(
|
||||||
|
height: 29,
|
||||||
|
width: 29,
|
||||||
|
child: widget.icon,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 15,
|
||||||
|
),
|
||||||
|
child: widget.subtitle != null
|
||||||
|
? Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
SizedBox(height: 8.5),
|
||||||
|
Text(widget.label),
|
||||||
|
SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
widget.subtitle,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
letterSpacing: -0.2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Padding(
|
||||||
|
padding: EdgeInsets.only(top: 1.5),
|
||||||
|
child: Text(widget.label),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 11),
|
||||||
|
child: widget.content ?? Container(),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -107,14 +107,14 @@ class _TriviaViewState extends State<TriviaView> {
|
|||||||
// restart everything.
|
// restart everything.
|
||||||
Widget _buildFinishedView() {
|
Widget _buildFinishedView() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(32.0),
|
padding: const EdgeInsets.all(32),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'All done!',
|
'All done!',
|
||||||
style: Styles.triviaFinishedTitleText,
|
style: Styles.triviaFinishedTitleText,
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.0),
|
SizedBox(height: 16),
|
||||||
Text(
|
Text(
|
||||||
'You answered',
|
'You answered',
|
||||||
style: Styles.triviaFinishedText,
|
style: Styles.triviaFinishedText,
|
||||||
@@ -129,7 +129,7 @@ class _TriviaViewState extends State<TriviaView> {
|
|||||||
style: Styles.triviaFinishedBigText,
|
style: Styles.triviaFinishedBigText,
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
child: Text(
|
child: Text(
|
||||||
' of ',
|
' of ',
|
||||||
style: Styles.triviaFinishedText,
|
style: Styles.triviaFinishedText,
|
||||||
@@ -145,7 +145,7 @@ class _TriviaViewState extends State<TriviaView> {
|
|||||||
'questions correctly!',
|
'questions correctly!',
|
||||||
style: Styles.triviaFinishedText,
|
style: Styles.triviaFinishedText,
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.0),
|
SizedBox(height: 16),
|
||||||
CupertinoButton(
|
CupertinoButton(
|
||||||
child: Text('Try Again'),
|
child: Text('Try Again'),
|
||||||
onPressed: () => _resetGame(),
|
onPressed: () => _resetGame(),
|
||||||
@@ -157,11 +157,16 @@ class _TriviaViewState extends State<TriviaView> {
|
|||||||
|
|
||||||
// Presents the current trivia's question and answer choices.
|
// Presents the current trivia's question and answer choices.
|
||||||
Widget _buildQuestionView() {
|
Widget _buildQuestionView() {
|
||||||
List<Widget> buttons = [];
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
for (int i = 0; i < currentTrivia.answers.length; i++) {
|
child: Column(
|
||||||
buttons.add(Padding(
|
children: [
|
||||||
padding: const EdgeInsets.all(8.0),
|
SizedBox(height: 16),
|
||||||
|
Text(currentTrivia.question),
|
||||||
|
SizedBox(height: 32),
|
||||||
|
for (int i = 0; i < currentTrivia.answers.length; i++)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
child: CupertinoButton(
|
child: CupertinoButton(
|
||||||
color: CupertinoColors.activeBlue,
|
color: CupertinoColors.activeBlue,
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -170,17 +175,8 @@ class _TriviaViewState extends State<TriviaView> {
|
|||||||
),
|
),
|
||||||
onPressed: () => _processAnswer(i),
|
onPressed: () => _processAnswer(i),
|
||||||
),
|
),
|
||||||
));
|
),
|
||||||
}
|
],
|
||||||
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(height: 16.0),
|
|
||||||
Text(currentTrivia.question),
|
|
||||||
SizedBox(height: 32.0),
|
|
||||||
]..addAll(buttons),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -189,13 +185,13 @@ class _TriviaViewState extends State<TriviaView> {
|
|||||||
// continue through the game.
|
// continue through the game.
|
||||||
Widget _buildResultView() {
|
Widget _buildResultView() {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(32.0),
|
padding: const EdgeInsets.all(32),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Text(status == PlayerStatus.wasCorrect
|
Text(status == PlayerStatus.wasCorrect
|
||||||
? 'That\'s right!'
|
? 'That\'s right!'
|
||||||
: 'Sorry, that wasn\'t the right answer.'),
|
: 'Sorry, that wasn\'t the right answer.'),
|
||||||
SizedBox(height: 16.0),
|
SizedBox(height: 16),
|
||||||
CupertinoButton(
|
CupertinoButton(
|
||||||
child: Text('Next Question'),
|
child: Text('Next Question'),
|
||||||
onPressed: () => setState(() {
|
onPressed: () => setState(() {
|
||||||
|
|||||||
@@ -2,19 +2,48 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:veggieseasons/data/veggie.dart';
|
import 'package:veggieseasons/data/veggie.dart';
|
||||||
import 'package:veggieseasons/screens/details.dart';
|
import 'package:veggieseasons/screens/details.dart';
|
||||||
import 'package:veggieseasons/styles.dart';
|
import 'package:veggieseasons/styles.dart';
|
||||||
|
|
||||||
|
class FrostyBackground extends StatelessWidget {
|
||||||
|
const FrostyBackground({
|
||||||
|
this.color,
|
||||||
|
this.intensity = 25,
|
||||||
|
this.child,
|
||||||
|
});
|
||||||
|
|
||||||
|
final Color color;
|
||||||
|
final double intensity;
|
||||||
|
final Widget child;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ClipRect(
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: intensity, sigmaY: intensity),
|
||||||
|
child: DecoratedBox(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: color,
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A Card-like Widget that responds to tap events by animating changes to its
|
/// A Card-like Widget that responds to tap events by animating changes to its
|
||||||
/// elevation and invoking an optional [onPressed] callback.
|
/// elevation and invoking an optional [onPressed] callback.
|
||||||
class PressableCard extends StatefulWidget {
|
class PressableCard extends StatefulWidget {
|
||||||
const PressableCard({
|
const PressableCard({
|
||||||
@required this.child,
|
@required this.child,
|
||||||
this.borderRadius = const BorderRadius.all(Radius.circular(10.0)),
|
this.borderRadius = const BorderRadius.all(Radius.circular(5)),
|
||||||
this.upElevation = 2.0,
|
this.upElevation = 2,
|
||||||
this.downElevation = 0.0,
|
this.downElevation = 0,
|
||||||
this.shadowColor = CupertinoColors.black,
|
this.shadowColor = CupertinoColors.black,
|
||||||
this.duration = const Duration(milliseconds: 100),
|
this.duration = const Duration(milliseconds: 100),
|
||||||
this.onPressed,
|
this.onPressed,
|
||||||
@@ -89,12 +118,10 @@ class VeggieCard extends StatelessWidget {
|
|||||||
final bool isPreferredCategory;
|
final bool isPreferredCategory;
|
||||||
|
|
||||||
Widget _buildDetails() {
|
Widget _buildDetails() {
|
||||||
return DecoratedBox(
|
return FrostyBackground(
|
||||||
decoration: BoxDecoration(
|
color: Color(0x90ffffff),
|
||||||
color: veggie.accentColor,
|
|
||||||
),
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -126,7 +153,7 @@ class VeggieCard extends StatelessWidget {
|
|||||||
Semantics(
|
Semantics(
|
||||||
label: 'A card background featuring ${veggie.name}',
|
label: 'A card background featuring ${veggie.name}',
|
||||||
child: Container(
|
child: Container(
|
||||||
height: isInSeason ? 350 : 150,
|
height: isInSeason ? 300 : 150,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
@@ -140,9 +167,9 @@ class VeggieCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0.0,
|
bottom: 0,
|
||||||
left: 0.0,
|
left: 0,
|
||||||
right: 0.0,
|
right: 0,
|
||||||
child: _buildDetails(),
|
child: _buildDetails(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -7,6 +7,39 @@ import 'package:veggieseasons/data/veggie.dart';
|
|||||||
import 'package:veggieseasons/screens/details.dart';
|
import 'package:veggieseasons/screens/details.dart';
|
||||||
import 'package:veggieseasons/styles.dart';
|
import 'package:veggieseasons/styles.dart';
|
||||||
|
|
||||||
|
class ZoomClipAssetImage extends StatelessWidget {
|
||||||
|
const ZoomClipAssetImage(
|
||||||
|
{@required this.zoom,
|
||||||
|
this.height,
|
||||||
|
this.width,
|
||||||
|
@required this.imageAsset});
|
||||||
|
|
||||||
|
final double zoom;
|
||||||
|
final double height;
|
||||||
|
final double width;
|
||||||
|
final String imageAsset;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
height: height,
|
||||||
|
width: width,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
child: OverflowBox(
|
||||||
|
maxHeight: height * zoom,
|
||||||
|
maxWidth: width * zoom,
|
||||||
|
child: Image.asset(
|
||||||
|
imageAsset,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class VeggieHeadline extends StatelessWidget {
|
class VeggieHeadline extends StatelessWidget {
|
||||||
final Veggie veggie;
|
final Veggie veggie;
|
||||||
|
|
||||||
@@ -16,14 +49,14 @@ class VeggieHeadline extends StatelessWidget {
|
|||||||
List<Widget> widgets = <Widget>[];
|
List<Widget> widgets = <Widget>[];
|
||||||
|
|
||||||
for (Season season in seasons) {
|
for (Season season in seasons) {
|
||||||
widgets.add(SizedBox(width: 4.0));
|
widgets.add(SizedBox(width: 4));
|
||||||
widgets.add(
|
widgets.add(
|
||||||
Container(
|
Container(
|
||||||
height: 10.0,
|
height: 10,
|
||||||
width: 10.0,
|
width: 10,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Styles.seasonColors[season],
|
color: Styles.seasonColors[season],
|
||||||
borderRadius: BorderRadius.circular(5.0),
|
borderRadius: BorderRadius.circular(5),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -42,31 +75,28 @@ class VeggieHeadline extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
ZoomClipAssetImage(
|
||||||
width: 80.0,
|
imageAsset: veggie.imageAssetPath,
|
||||||
height: 80.0,
|
zoom: 2.4,
|
||||||
child: ClipRRect(
|
height: 72,
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
width: 72,
|
||||||
child: Image.asset(
|
|
||||||
veggie.imageAssetPath,
|
|
||||||
semanticLabel: 'An icon showing ${veggie.name}',
|
|
||||||
fit: BoxFit.fitWidth,
|
|
||||||
),
|
),
|
||||||
),
|
SizedBox(width: 8),
|
||||||
),
|
|
||||||
SizedBox(width: 8.0),
|
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: [
|
||||||
Text(veggie.name, style: Styles.headlineName),
|
Text(veggie.name, style: Styles.headlineName),
|
||||||
]..addAll(_buildSeasonDots(veggie.seasons)),
|
..._buildSeasonDots(veggie.seasons),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
veggie.shortDescription,
|
||||||
|
style: Styles.headlineDescription,
|
||||||
),
|
),
|
||||||
Text(veggie.shortDescription,
|
|
||||||
style: Styles.headlineDescription),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ packages:
|
|||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.8"
|
version: "2.1.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -117,7 +117,7 @@ packages:
|
|||||||
name: matcher
|
name: matcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.3+1"
|
version: "0.12.5"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -138,7 +138,7 @@ packages:
|
|||||||
name: pedantic
|
name: pedantic
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.0"
|
version: "1.5.0"
|
||||||
petitparser:
|
petitparser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -152,7 +152,7 @@ packages:
|
|||||||
name: quiver
|
name: quiver
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "2.0.2"
|
||||||
scoped_model:
|
scoped_model:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -178,7 +178,7 @@ packages:
|
|||||||
name: source_span
|
name: source_span
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.5.4"
|
version: "1.5.5"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -192,7 +192,7 @@ packages:
|
|||||||
name: stream_channel
|
name: stream_channel
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.6.8"
|
version: "2.0.0"
|
||||||
string_scanner:
|
string_scanner:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -213,7 +213,7 @@ packages:
|
|||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.2"
|
version: "0.2.4"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -243,5 +243,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.15"
|
version: "2.1.15"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.1.0 <3.0.0"
|
dart: ">=2.3.0-dev <3.0.0"
|
||||||
flutter: ">=0.1.4 <2.0.0"
|
flutter: ">=0.1.4 <2.0.0"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ description: An iOS app that shows the fruits and veggies currently in season.
|
|||||||
version: 1.0.0+1
|
version: 1.0.0+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.1.0 <3.0.0"
|
sdk: ">=2.3.0-dev <3.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
|||||||
Reference in New Issue
Block a user