Skip to content

Commit 1076d5f

Browse files
committed
Replace Deprecated FlatButtons
- Replace deprecated FlatButtons with TextButton. - Support cursor hover change.
1 parent 124112c commit 1076d5f

File tree

2 files changed

+29
-32
lines changed

2 files changed

+29
-32
lines changed

lib/components/blog.dart

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,10 @@ class MenuBar extends StatelessWidget {
342342
margin: const EdgeInsets.symmetric(vertical: 30),
343343
child: Row(
344344
children: <Widget>[
345-
GestureDetector(
345+
InkWell(
346+
hoverColor: Colors.transparent,
347+
highlightColor: Colors.transparent,
348+
splashColor: Colors.transparent,
346349
onTap: () => Navigator.popUntil(
347350
context, ModalRoute.withName(Navigator.defaultRouteName)),
348351
child: Text("MINIMAL",
@@ -357,57 +360,42 @@ class MenuBar extends StatelessWidget {
357360
alignment: Alignment.centerRight,
358361
child: Wrap(
359362
children: <Widget>[
360-
FlatButton(
363+
TextButton(
361364
onPressed: () => Navigator.popUntil(context,
362365
ModalRoute.withName(Navigator.defaultRouteName)),
363-
child: Text(
366+
child: const Text(
364367
"HOME",
365-
style: buttonTextStyle,
366368
),
367-
splashColor: Colors.transparent,
368-
hoverColor: Colors.transparent,
369-
highlightColor: Colors.transparent,
369+
style: menuButtonStyle,
370370
),
371-
FlatButton(
371+
TextButton(
372372
onPressed: () {},
373-
child: Text(
373+
child: const Text(
374374
"PORTFOLIO",
375-
style: buttonTextStyle,
376375
),
377-
splashColor: Colors.transparent,
378-
hoverColor: Colors.transparent,
379-
highlightColor: Colors.transparent,
376+
style: menuButtonStyle,
380377
),
381-
FlatButton(
378+
TextButton(
382379
onPressed: () =>
383380
Navigator.pushNamed(context, Routes.style),
384-
child: Text(
381+
child: const Text(
385382
"STYLE",
386-
style: buttonTextStyle,
387383
),
388-
splashColor: Colors.transparent,
389-
hoverColor: Colors.transparent,
390-
highlightColor: Colors.transparent,
384+
style: menuButtonStyle,
391385
),
392-
FlatButton(
386+
TextButton(
393387
onPressed: () {},
394-
child: Text(
388+
child: const Text(
395389
"ABOUT",
396-
style: buttonTextStyle,
397390
),
398-
splashColor: Colors.transparent,
399-
hoverColor: Colors.transparent,
400-
highlightColor: Colors.transparent,
391+
style: menuButtonStyle,
401392
),
402-
FlatButton(
393+
TextButton(
403394
onPressed: () {},
404-
child: Text(
395+
child: const Text(
405396
"CONTACT",
406-
style: buttonTextStyle,
407397
),
408-
splashColor: Colors.transparent,
409-
hoverColor: Colors.transparent,
410-
highlightColor: Colors.transparent,
398+
style: menuButtonStyle,
411399
),
412400
],
413401
),

lib/components/text.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import 'package:flutter/widgets.dart';
1+
import 'package:flutter/material.dart';
22
import 'package:minimal/components/spacing.dart';
33
import 'package:minimal/components/typography.dart';
44

5+
import 'color.dart';
6+
57
class TextBody extends StatelessWidget {
68
final String text;
79

@@ -75,3 +77,10 @@ class TextBlockquote extends StatelessWidget {
7577
);
7678
}
7779
}
80+
81+
ButtonStyle? menuButtonStyle = TextButton.styleFrom(
82+
backgroundColor: Colors.transparent,
83+
onSurface: null,
84+
primary: textSecondary,
85+
textStyle: buttonTextStyle,
86+
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16));

0 commit comments

Comments
 (0)