Skip to content

Commit

Permalink
White theme added
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAlphamerc committed Feb 1, 2020
1 parent e599202 commit b2933a0
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 268 deletions.
45 changes: 21 additions & 24 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_soft_ui/src/theme/lightColors.dart';
import 'package:flutter_soft_ui/src/theme/darkColors.dart';
import 'package:flutter_soft_ui/src/theme/theme.dart';
import 'package:flutter_soft_ui/src/widget/customClipPainter.dart';
import 'package:flutter_soft_ui/src/widget/softContainer.dart';
import 'package:google_fonts/google_fonts.dart';
import 'dart:async';

import 'package:flutter/material.dart';
import 'src/homepage.dart';
import 'src/theme/theme.dart';
import 'src/watchDetail.dart';
import 'src/widget/customRoute.dart';

void main() {
runApp(MyApp());
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor: Color(0xff141414), // navigation bar color
statusBarColor: Color(0xff141414), // status bar color
));

}

class MyApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
backgroundColor: DarkColor.background,
primaryColor: DarkColor.black,
accentColor: DarkColor.lightblack,
cardTheme: CardTheme(color: DarkColor.backgroundColor),
textTheme: TextTheme(display1: TextStyle(color: Color(0xffd1d1d0))),
iconTheme: IconThemeData(color: DarkColor.lightGrey)),
debugShowCheckedModeBanner: false,
return StreamBuilder(
stream: bloc.darkThemeEnabled,
initialData: true,
builder: (context, snapshot) => MaterialApp(
theme: snapshot.data ? AppTheme.darkTheme : AppTheme.lightTheme,
debugShowCheckedModeBanner: false,
routes: <String, WidgetBuilder>{
'/': (_) => MyHomePage(),
'/detail': (_) => WatchDetailPage()
Expand All @@ -46,6 +34,15 @@ class MyApp extends StatelessWidget {
return CustomRoute<bool>(
builder: (BuildContext context) => WatchDetailPage());
}
});
}),
);

}
}
class Bloc {
final _themeController = StreamController<bool>();
get changeTheme => _themeController.sink.add;
get darkThemeEnabled => _themeController.stream;
}

final bloc = Bloc();
92 changes: 29 additions & 63 deletions lib/src/homepage.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_soft_ui/src/theme/darkColors.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:google_fonts/google_fonts.dart';

import '../main.dart';
import 'theme/theme.dart';
import 'widget/bottomNavigationbar.dart';
import 'widget/customClipPainter.dart';
import 'widget/softContainer.dart';

class MyHomePage extends StatefulWidget {

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
var block = Bloc();
bool darkThemeEnabled = false;
Widget appbarWidget() {
return Container(
width: MediaQuery.of(context).size.width - 40,
Expand Down Expand Up @@ -55,13 +60,18 @@ class _MyHomePageState extends State<MyHomePage> {
)),
Hero(
tag: 'cartIcon',
child: SoftContainer(
height: 50,
width: 50,
cornerRadius: 25,
child: Icon(FontAwesomeIcons.shareAlt,
color: Theme.of(context).iconTheme.color),
))
child: GestureDetector(
onTap: () {
darkThemeEnabled = !darkThemeEnabled;
bloc.changeTheme(darkThemeEnabled);
},
child: SoftContainer(
height: 50,
width: 50,
cornerRadius: 25,
child: Icon(FontAwesomeIcons.lightbulb,
color: Theme.of(context).iconTheme.color),
)))
],
),
);
Expand Down Expand Up @@ -95,23 +105,9 @@ class _MyHomePageState extends State<MyHomePage> {
return Container(
height: 70,
width: 70,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: Colors.blue,
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: [
.2,
.4,
.7
],
colors: [
Color(0xff2c53b2),
Color(0xff3b4ea7),
Color(0xff6e3c7d),
])),
child: Icon(Icons.watch, color: Theme.of(context).iconTheme.color),
decoration: AppTheme.getDecoration(context, borderRadius: 10),
child:
Icon(Icons.watch, color: Theme.of(context).colorScheme.onSecondary),
);
}

Expand All @@ -130,18 +126,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Hero(
tag: 'pentaContainer',
child: ClipShadow(
boxShadow: [
BoxShadow(
color: DarkColor.Darker,
offset: Offset(offset, offset),
blurRadius: blurRadius,
spreadRadius: spreadRadius),
BoxShadow(
color: DarkColor.Brighter,
offset: Offset(-offset, -offset),
blurRadius: blurRadius,
spreadRadius: spreadRadius),
],
boxShadow: AppTheme.getshadow(context),
clipper: ClipPainter(),
child: Container(
height: MediaQuery.of(context).size.width * .65,
Expand All @@ -152,17 +137,7 @@ class _MyHomePageState extends State<MyHomePage> {
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(20),
topRight: Radius.circular(40)),
color: Color(0xff101010),
boxShadow: <BoxShadow>[
BoxShadow(
color: Color(0xff000000),
offset: Offset(2, 2),
blurRadius: 10),
BoxShadow(
color: Theme.of(context).accentColor,
offset: Offset(-2, -2),
blurRadius: 10),
],
color: Theme.of(context).backgroundColor,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down Expand Up @@ -202,7 +177,7 @@ class _MyHomePageState extends State<MyHomePage> {
style: GoogleFonts.montserrat(
textStyle: Theme.of(context).textTheme.display1,
fontSize: 15,
color: Color(0xff797878),
color: DarkColor.subTitleTextColor,
fontWeight: FontWeight.w700,
fontStyle: FontStyle.normal,
),
Expand Down Expand Up @@ -254,7 +229,7 @@ class _MyHomePageState extends State<MyHomePage> {
text,
style: TextStyle(
color: enable
? DarkColor.titleTextColor
? Theme.of(context).textTheme.display1.color
: DarkColor.subTitleTextColor,
fontWeight: FontWeight.bold,
),
Expand All @@ -263,19 +238,7 @@ class _MyHomePageState extends State<MyHomePage> {
Container(
height: 3,
width: enable ? 70 : 0,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: [
.1,
.5
],
colors: [
Color(0xff2c53b2),
Color(0xff6e3c7d),
]),
),
decoration: AppTheme.getDecoration(context, borderRadius: 10),
),
],
),
Expand Down Expand Up @@ -313,8 +276,11 @@ class _MyHomePageState extends State<MyHomePage> {

@override
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor: Theme.of(context).backgroundColor,
statusBarColor: Theme.of(context).backgroundColor));
return Scaffold(
backgroundColor: Color(0xff101010),
backgroundColor: Theme.of(context).backgroundColor,
body: Container(
height: MediaQuery.of(context).size.height,
child: SingleChildScrollView(
Expand Down
18 changes: 7 additions & 11 deletions lib/src/theme/darkColors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@ import 'package:flutter/material.dart';

class DarkColor {

static const Color background = Color(0xff040405);
// static const Color shadowPrimary = Color(0xff3E404D);
// static const Color shadowSecondary = Color(0xff7D8282);

static const Color background = Color(0xff101010);
static const Color black = Color(0xff000000);
static const Color lightblack = Color(0xff232525);
// static const Color grey = Color(0xff7D8282);
static const Color white = Color(0xffffffff);
static const Color lightGrey = Color(0xff797878);
// static const Color darkBlue = Color(0xff13165A);
// static const Color lightBlue = Color(0xff203387);
static const Color darkBlue = Color(0xff3b4ea7);
static const Color lightBlue = Color(0xff2c53b2);
static const Color darkPink = Color(0xff6e3c7d);
static const Color purple = Color(0xff524693);

static const Color Brighter = Color(0xff1a1a1c);
static const Color LightBrighter = const Color(0xff19191b);
static const Color Darker = Colors.black;
static const Color backgroundColor = const Color(0xff101010);
static const Color titleTextColor = const Color(0xffd1d1d0);
static const Color subTitleTextColor = const Color(0xff797878);
static const Color subTitleTextColor = const Color(0xff797878);
}
10 changes: 4 additions & 6 deletions lib/src/theme/lightColors.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import 'package:flutter/material.dart';

class LightColor {

static const Color background = Color(0xfff1f3f6);
static const Color shadowPrimary = Color(0xff3754aa);
static const Color shadowSecondary = Color(0xffffffff);

static Color Brighter = Color(0xff3754aa).withAlpha(25);
static const Color Darker = Color(0xffffffff);
static const Color black = Color(0xff040405);
static const Color lightblack = Color(0xff3E404D);
static const Color grey = Color(0xff7D8282);
static const Color lightGrey = Color(0xffDFE7DD);
static const Color darkBlue = Color(0xff13165A);
static const Color lightBlue = Color(0xff203387);
static const Color darkBlue = Color(0xff13165A);
static const Color lightBlue = Color(0xff203387);
}
Loading

0 comments on commit b2933a0

Please sign in to comment.