Skip to content

My submission #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Images/Custom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,15 @@ Your Challenge is to make this screen more interesting with custom themeing. A c
- Not required, but encouraged: theming, as above, for the third theme as well.

That's it! Good luck :)

## App Screenshots!

<img src="https://user-images.githubusercontent.com/53489549/114847048-e5ef9280-9dfa-11eb-95c0-acc384849334.png" width="300"> <img src="https://user-images.githubusercontent.com/53489549/114847081-ee47cd80-9dfa-11eb-8d02-03a417a9cb35.png" width="300"> <img src="https://user-images.githubusercontent.com/53489549/114847086-f142be00-9dfa-11eb-9bd8-21f37b9eed95.png" width="300">

# App In Action!
<img src="https://user-images.githubusercontent.com/53489549/114849456-631c0700-9dfd-11eb-990c-3efba0aca89d.gif" width="300">





25 changes: 18 additions & 7 deletions lib/scenery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,26 @@ class _SceneryState extends State<Scenery> {
children: [
CustomPaint(
foregroundPainter: SceneryPainter(
skyColor: CustomWidgetThemes.of(context).sceneryThemeData!.skyFillColor,
waterColor: CustomWidgetThemes.of(context).sceneryThemeData!.waterFillColor,
mountainColor: CustomWidgetThemes.of(context).sceneryThemeData!.mountainFillColor,
skyColor:
CustomWidgetThemes.of(context).sceneryThemeData!.skyFillColor,
waterColor: CustomWidgetThemes.of(context)
.sceneryThemeData!
.waterFillColor,
mountainColor: CustomWidgetThemes.of(context)
.sceneryThemeData!
.mountainFillColor,
textHeight: _textAreaHeight,
drawSun: CustomWidgetThemes.of(context).sceneryThemeData!.drawSun,
drawMoon: CustomWidgetThemes.of(context).sceneryThemeData!.drawMoon,
drawMoon:
CustomWidgetThemes.of(context).sceneryThemeData!.drawMoon,
),
child: Container(),
),
//todo(you) - Can you find a way to toggle this text area background color according to the theme?
Positioned(
bottom: 0,
child: Container(
color: myTheme.currentThemeData.primaryColorLight,
height: _textAreaHeight,
width: constraints.maxWidth,
child: const SomeText(),
Expand All @@ -45,6 +52,7 @@ class _SceneryState extends State<Scenery> {
right: 0,
child: Container(
width: constraints.maxWidth,
color: myTheme.currentThemeData.primaryColor,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
Expand All @@ -56,7 +64,8 @@ class _SceneryState extends State<Scenery> {
title: const Text('Light'),
groupValue: myTheme.themeType,
value: ThemeType.Light,
onChanged: (ThemeType? mode) => myTheme.setThemeType(ThemeType.Light),
onChanged: (ThemeType? mode) =>
myTheme.setThemeType(ThemeType.Light),
),
),
Expanded(
Expand All @@ -65,7 +74,8 @@ class _SceneryState extends State<Scenery> {
title: const Text('Dark'),
groupValue: myTheme.themeType,
value: ThemeType.Dark,
onChanged: (ThemeType? mode) => myTheme.setThemeType(ThemeType.Dark),
onChanged: (ThemeType? mode) =>
myTheme.setThemeType(ThemeType.Dark),
),
),
Expanded(
Expand All @@ -74,7 +84,8 @@ class _SceneryState extends State<Scenery> {
title: const Text('Other'),
groupValue: myTheme.themeType,
value: ThemeType.Other,
onChanged: (ThemeType? mode) => myTheme.setThemeType(ThemeType.Other),
onChanged: (ThemeType? mode) =>
myTheme.setThemeType(ThemeType.Other),
),
),
],
Expand Down
21 changes: 11 additions & 10 deletions lib/themes/custom_themes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import 'scenery_theme.dart';
/// You can add themes for your own custom widgets here.
/// NB: for this challenge, it is only required to modify sceneryThemeData
class CustomWidgetThemes {
static CustomWidgetThemes of(BuildContext context) => CustomWidgetThemes._(context);
static CustomWidgetThemes of(BuildContext context) =>
CustomWidgetThemes._(context);

SceneryThemeData? sceneryThemeData;

Expand All @@ -19,27 +20,27 @@ class CustomWidgetThemes {
switch (themeType) {
case ThemeType.Light:
sceneryThemeData = SceneryThemeData(
skyFillColor: Colors.grey,
mountainFillColor: Colors.blueGrey,
waterFillColor: Colors.blueGrey[800]!,
skyFillColor: Colors.orangeAccent[200]!,
mountainFillColor: Colors.brown,
waterFillColor: Colors.lightBlue.shade300,
drawMoon: false,
drawSun: true,
);
break;
case ThemeType.Dark:
sceneryThemeData = SceneryThemeData(
skyFillColor: Colors.grey,
mountainFillColor: Colors.blueGrey,
waterFillColor: Colors.blueGrey[800]!,
skyFillColor: Colors.grey[800]!,
mountainFillColor: Colors.redAccent,
waterFillColor: Colors.blueGrey[200]!,
drawMoon: true,
drawSun: false,
);
break;
case ThemeType.Other:
sceneryThemeData = SceneryThemeData(
skyFillColor: Colors.grey,
mountainFillColor: Colors.blueGrey,
waterFillColor: Colors.blueGrey[800]!,
skyFillColor: Colors.pink[900]!,
mountainFillColor: Colors.purple[300]!,
waterFillColor: Colors.pinkAccent,
drawMoon: true,
drawSun: true,
);
Expand Down
35 changes: 32 additions & 3 deletions lib/themes/my_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,40 @@ class MyTheme with ChangeNotifier {
ThemeData get currentThemeData {
switch (themeType) {
case ThemeType.Light:
return ThemeData();
return ThemeData(
primaryColor: Colors.lime,
primaryColorLight: Color(0xff96cdf0),
accentColor: Color(0xff182628),
backgroundColor: Color(0xff3b945e),
textTheme: TextTheme(
headline3: TextStyle(
color: Color(0xff0E1132), fontWeight: FontWeight.bold),
subtitle1: TextStyle(
color: Color(0xff0E1132), fontWeight: FontWeight.w600),
bodyText1: TextStyle(color: Color(0xff04396C))));
case ThemeType.Dark:
return ThemeData();
return ThemeData(
primaryColor: Color(0xff10282d),
primaryColorLight: Color(0xff4E4E50),
accentColor: Color(0xffe1f1f4),
backgroundColor: Color(0xff182628),
textTheme: TextTheme(
headline3: TextStyle(
color: Color(0xffffffff), fontWeight: FontWeight.bold),
subtitle1: TextStyle(
color: Color(0xffffffff), fontWeight: FontWeight.w600),
bodyText1: TextStyle(color: Color(0xebEDF5E0))));
case ThemeType.Other:
return ThemeData();
return ThemeData(
primaryColor: Colors.pink[100],
primaryColorLight: Colors.deepPurpleAccent[100],
accentColor: Color(0xff2a1b3d),
textTheme: TextTheme(
headline3: TextStyle(
color: Color(0xff25274D), fontWeight: FontWeight.bold),
subtitle1: TextStyle(
color: Color(0xff25274D), fontWeight: FontWeight.w600),
bodyText1: TextStyle(color: Color(0xff24315E))));
}
}
}
Expand Down