Skip to content

Commit

Permalink
Replace Deprecated FlatButtons
Browse files Browse the repository at this point in the history
- Replace deprecated FlatButtons with TextButton.
- Support cursor hover change.
  • Loading branch information
rayliverified committed Feb 12, 2022
1 parent 124112c commit 1076d5f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 32 deletions.
50 changes: 19 additions & 31 deletions lib/components/blog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,10 @@ class MenuBar extends StatelessWidget {
margin: const EdgeInsets.symmetric(vertical: 30),
child: Row(
children: <Widget>[
GestureDetector(
InkWell(
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
onTap: () => Navigator.popUntil(
context, ModalRoute.withName(Navigator.defaultRouteName)),
child: Text("MINIMAL",
Expand All @@ -357,57 +360,42 @@ class MenuBar extends StatelessWidget {
alignment: Alignment.centerRight,
child: Wrap(
children: <Widget>[
FlatButton(
TextButton(
onPressed: () => Navigator.popUntil(context,
ModalRoute.withName(Navigator.defaultRouteName)),
child: Text(
child: const Text(
"HOME",
style: buttonTextStyle,
),
splashColor: Colors.transparent,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
style: menuButtonStyle,
),
FlatButton(
TextButton(
onPressed: () {},
child: Text(
child: const Text(
"PORTFOLIO",
style: buttonTextStyle,
),
splashColor: Colors.transparent,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
style: menuButtonStyle,
),
FlatButton(
TextButton(
onPressed: () =>
Navigator.pushNamed(context, Routes.style),
child: Text(
child: const Text(
"STYLE",
style: buttonTextStyle,
),
splashColor: Colors.transparent,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
style: menuButtonStyle,
),
FlatButton(
TextButton(
onPressed: () {},
child: Text(
child: const Text(
"ABOUT",
style: buttonTextStyle,
),
splashColor: Colors.transparent,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
style: menuButtonStyle,
),
FlatButton(
TextButton(
onPressed: () {},
child: Text(
child: const Text(
"CONTACT",
style: buttonTextStyle,
),
splashColor: Colors.transparent,
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
style: menuButtonStyle,
),
],
),
Expand Down
11 changes: 10 additions & 1 deletion lib/components/text.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
import 'package:minimal/components/spacing.dart';
import 'package:minimal/components/typography.dart';

import 'color.dart';

class TextBody extends StatelessWidget {
final String text;

Expand Down Expand Up @@ -75,3 +77,10 @@ class TextBlockquote extends StatelessWidget {
);
}
}

ButtonStyle? menuButtonStyle = TextButton.styleFrom(
backgroundColor: Colors.transparent,
onSurface: null,
primary: textSecondary,
textStyle: buttonTextStyle,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16));

0 comments on commit 1076d5f

Please sign in to comment.