Skip to content

Changed variable name to adhere to Google's documented best practices… #201

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

Closed
wants to merge 4 commits into from
Closed
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
64 changes: 32 additions & 32 deletions mdc_100_series/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class _ShrineAppState extends State<ShrineApp> {
),
initialRoute: '/login',
onGenerateRoute: _getRoute,
theme: _kShrineTheme,
theme: _shrineTheme,
);
}

Expand All @@ -70,31 +70,31 @@ Route<dynamic> _getRoute(RouteSettings settings) {
);
}

final ThemeData _kShrineTheme = _buildShrineTheme();
final ThemeData _shrineTheme = _buildShrineTheme();

IconThemeData _customIconTheme(IconThemeData original) {
return original.copyWith(color: kShrineBrown900);
return original.copyWith(color: shrineBrown900);
}

ThemeData _buildShrineTheme() {
final ThemeData base = ThemeData.light();
return base.copyWith(
accentColor: kShrineBrown900,
primaryColor: kShrinePink100,
scaffoldBackgroundColor: kShrineBackgroundWhite,
cardColor: kShrineBackgroundWhite,
textSelectionColor: kShrinePink100,
errorColor: kShrineErrorRed,
accentColor: shrineBrown900,
primaryColor: shrinePink100,
scaffoldBackgroundColor: shrineBackgroundWhite,
cardColor: shrineBackgroundWhite,
textSelectionColor: shrinePink100,
errorColor: shrineErrorRed,
buttonTheme: base.buttonTheme.copyWith(
buttonColor: kShrinePink100,
buttonColor: shrinePink100,
colorScheme: base.colorScheme.copyWith(
secondary: kShrineBrown900,
secondary: shrineBrown900,
),
),
buttonBarTheme: base.buttonBarTheme.copyWith(
buttonTextTheme: ButtonTextTheme.accent,
),
primaryIconTheme: base.iconTheme.copyWith(color: kShrineBrown900),
primaryIconTheme: base.iconTheme.copyWith(color: shrineBrown900),
inputDecorationTheme: InputDecorationTheme(
border: CutCornersBorder(),
),
Expand All @@ -106,24 +106,24 @@ ThemeData _buildShrineTheme() {
}

TextTheme _buildShrineTextTheme(TextTheme base) {
return base.copyWith(
headline5: base.headline5.copyWith(
fontWeight: FontWeight.w500,
),
headline6: base.headline6.copyWith(
fontSize: 18.0
),
caption: base.caption.copyWith(
fontWeight: FontWeight.w400,
fontSize: 14.0,
),
bodyText1: base.bodyText1.copyWith(
fontWeight: FontWeight.w500,
fontSize: 16.0,
),
).apply(
fontFamily: 'Rubik',
displayColor: kShrineBrown900,
bodyColor: kShrineBrown900,
);
return base
.copyWith(
headline5: base.headline5.copyWith(
fontWeight: FontWeight.w500,
),
headline6: base.headline6.copyWith(fontSize: 18.0),
caption: base.caption.copyWith(
fontWeight: FontWeight.w400,
fontSize: 14.0,
),
bodyText1: base.bodyText1.copyWith(
fontWeight: FontWeight.w500,
fontSize: 16.0,
),
)
.apply(
fontFamily: 'Rubik',
displayColor: shrineBrown900,
bodyColor: shrineBrown900,
);
}
15 changes: 7 additions & 8 deletions mdc_100_series/lib/backdrop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import 'package:meta/meta.dart';
import 'model/product.dart';
import 'login.dart';

const double _kFlingVelocity = 2.0;
const double _flingVelocity = 2.0;

class _FrontLayer extends StatelessWidget {
const _FrontLayer({
Expand Down Expand Up @@ -98,7 +98,8 @@ class _BackdropTitle extends AnimatedWidget {
end: Offset(1.0, 0.0),
).evaluate(animation),
child: ImageIcon(AssetImage('assets/diamond.png')),
)]),
)
]),
),
),
// Here, we do a custom cross fade between backTitle and frontTitle.
Expand All @@ -117,8 +118,7 @@ class _BackdropTitle extends AnimatedWidget {
).evaluate(animation),
child: Semantics(
label: 'hide categories menu',
child: ExcludeSemantics(child: backTitle)
),
child: ExcludeSemantics(child: backTitle)),
),
),
Opacity(
Expand All @@ -133,8 +133,7 @@ class _BackdropTitle extends AnimatedWidget {
).evaluate(animation),
child: Semantics(
label: 'show categories menu',
child: ExcludeSemantics(child: frontTitle)
),
child: ExcludeSemantics(child: frontTitle)),
),
),
],
Expand Down Expand Up @@ -195,7 +194,7 @@ class _BackdropState extends State<Backdrop>
if (widget.currentCategory != old.currentCategory) {
_toggleBackdropLayerVisibility();
} else if (!_frontLayerVisible) {
_controller.fling(velocity: _kFlingVelocity);
_controller.fling(velocity: _flingVelocity);
}
}

Expand All @@ -213,7 +212,7 @@ class _BackdropState extends State<Backdrop>

void _toggleBackdropLayerVisibility() {
_controller.fling(
velocity: _frontLayerVisible ? -_kFlingVelocity : _kFlingVelocity);
velocity: _frontLayerVisible ? -_flingVelocity : _flingVelocity);
}

Widget _buildStack(BuildContext context, BoxConstraints constraints) {
Expand Down
57 changes: 28 additions & 29 deletions mdc_100_series/lib/category_menu_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,31 @@ class CategoryMenuPage extends StatelessWidget {
return GestureDetector(
onTap: () => onCategoryTap(category),
child: category == currentCategory
? Column(
children: <Widget>[
SizedBox(height: 16.0),
Text(
categoryString,
style: theme.textTheme.bodyText1,
textAlign: TextAlign.center,
? Column(
children: <Widget>[
SizedBox(height: 16.0),
Text(
categoryString,
style: theme.textTheme.bodyText1,
textAlign: TextAlign.center,
),
SizedBox(height: 14.0),
Container(
width: 70.0,
height: 2.0,
color: shrinePink400,
),
],
)
: Padding(
padding: EdgeInsets.symmetric(vertical: 16.0),
child: Text(
categoryString,
style: theme.textTheme.bodyText1
.copyWith(color: shrineBrown900.withAlpha(153)),
textAlign: TextAlign.center,
),
),
SizedBox(height: 14.0),
Container(
width: 70.0,
height: 2.0,
color: kShrinePink400,
),
],
)
: Padding(
padding: EdgeInsets.symmetric(vertical: 16.0),
child: Text(
categoryString,
style: theme.textTheme.bodyText1.copyWith(
color: kShrineBrown900.withAlpha(153)
),
textAlign: TextAlign.center,
),
),
);
}

Expand All @@ -71,11 +70,11 @@ class CategoryMenuPage extends StatelessWidget {
return Center(
child: Container(
padding: EdgeInsets.only(top: 40.0),
color: kShrinePink100,
color: shrinePink100,
child: ListView(
children: _categories
.map((Category c) => _buildCategory(c, context))
.toList()),
children: _categories
.map((Category c) => _buildCategory(c, context))
.toList()),
),
);
}
Expand Down
16 changes: 8 additions & 8 deletions mdc_100_series/lib/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

import 'package:flutter/material.dart';

const kShrinePink50 = const Color(0xFFFEEAE6);
const kShrinePink100 = const Color(0xFFFEDBD0);
const kShrinePink300 = const Color(0xFFFBB8AC);
const kShrinePink400 = const Color(0xFFEAA4A4);
const shrinePink50 = const Color(0xFFFEEAE6);
const shrinePink100 = const Color(0xFFFEDBD0);
const shrinePink300 = const Color(0xFFFBB8AC);
const shrinePink400 = const Color(0xFFEAA4A4);

const kShrineBrown900 = const Color(0xFF442B2D);
const shrineBrown900 = const Color(0xFF442B2D);

const kShrineErrorRed = const Color(0xFFC5032B);
const shrineErrorRed = const Color(0xFFC5032B);

const kShrineSurfaceWhite = const Color(0xFFFFFBFA);
const kShrineBackgroundWhite = Colors.white;
const shrineSurfaceWhite = const Color(0xFFFFFBFA);
const shrineBackgroundWhite = Colors.white;
4 changes: 2 additions & 2 deletions mdc_100_series/lib/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class _LoginPageState extends State<LoginPage> {
),
SizedBox(height: 120.0),
AccentColorOverride(
color: kShrineBrown900,
color: shrineBrown900,
child: TextField(
controller: _usernameController,
decoration: InputDecoration(
Expand All @@ -55,7 +55,7 @@ class _LoginPageState extends State<LoginPage> {
),
SizedBox(height: 12.0),
AccentColorOverride(
color: kShrineBrown900,
color: shrineBrown900,
child: TextField(
controller: _passwordController,
decoration: InputDecoration(
Expand Down