Skip to content
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
6 changes: 6 additions & 0 deletions mdc_100_series/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ ThemeData _buildShrineTheme() {
color: kShrineBrown900
),
inputDecorationTheme: InputDecorationTheme(
focusedBorder: CutCornersBorder(
borderSide: BorderSide(
width: 2.0,
color: kShrineBrown900,
),
),
border: CutCornersBorder(),
),
textTheme: _buildShrineTextTheme(base.textTheme),
Expand Down
70 changes: 34 additions & 36 deletions mdc_100_series/lib/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

import 'package:flutter/material.dart';

import 'colors.dart';

class LoginPage extends StatefulWidget {
@override
_LoginPageState createState() => _LoginPageState();
Expand All @@ -24,6 +22,23 @@ class LoginPage extends StatefulWidget {
class _LoginPageState extends State<LoginPage> {
final _usernameController = TextEditingController();
final _passwordController = TextEditingController();
final _unfocusedColor = Colors.grey[600];
FocusNode _usernamefocusTracker = FocusNode();
FocusNode _passwordfocusTracker = FocusNode();

@override
void initState() {
super.initState();
_usernamefocusTracker = FocusNode()
..addListener(() {
setState(() {});
});

_passwordfocusTracker = FocusNode()
..addListener(() {
setState(() {});
});
}

@override
Widget build(BuildContext context) {
Expand All @@ -44,25 +59,27 @@ class _LoginPageState extends State<LoginPage> {
],
),
SizedBox(height: 120.0),
AccentColorOverride(
color: kShrineBrown900,
child: TextField(
controller: _usernameController,
decoration: InputDecoration(
labelText: 'Username',
),
TextField(
controller: _usernameController,
decoration: InputDecoration(
labelText: 'Username',
labelStyle: _usernamefocusTracker.hasFocus
? TextStyle(color: Theme.of(context).accentColor)
: TextStyle(color: _unfocusedColor),
),
focusNode: _usernamefocusTracker,
),
SizedBox(height: 12.0),
AccentColorOverride(
color: kShrineBrown900,
child: TextField(
controller: _passwordController,
decoration: InputDecoration(
labelText: 'Password',
),
obscureText: true,
TextField(
controller: _passwordController,
decoration: InputDecoration(
labelText: 'Password',
labelStyle: _passwordfocusTracker.hasFocus
? TextStyle(color: Theme.of(context).accentColor)
: TextStyle(color: _unfocusedColor),
),
focusNode: _passwordfocusTracker,
obscureText: true,
),
ButtonBar(
children: <Widget>[
Expand Down Expand Up @@ -94,22 +111,3 @@ class _LoginPageState extends State<LoginPage> {
);
}
}

class AccentColorOverride extends StatelessWidget {
const AccentColorOverride({Key key, this.color, this.child})
: super(key: key);

final Color color;
final Widget child;

@override
Widget build(BuildContext context) {
return Theme(
child: child,
data: Theme.of(context).copyWith(
accentColor: color,
brightness: Brightness.dark,
),
);
}
}
6 changes: 2 additions & 4 deletions mdc_100_series/lib/supplemental/product_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,17 @@ class ProductCard extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
// TODO(larche): Make headline6 when available
Text(
product == null ? '' : product.name,
style: theme.textTheme.button,
style: theme.textTheme.headline6,
softWrap: false,
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
SizedBox(height: 4.0),
// TODO(larche): Make subtitle2 when available
Text(
product == null ? '' : formatter.format(product.price),
style: theme.textTheme.caption,
style: theme.textTheme.subtitle2,
),
],
),
Expand Down