11import 'package:flutter/material.dart' ;
2- import 'package:flutter/widgets.dart' ;
32import 'package:google_fonts/google_fonts.dart' ;
43import 'package:minimal/components/color.dart' ;
54import 'package:minimal/components/spacing.dart' ;
@@ -70,36 +69,56 @@ class Tag extends StatelessWidget {
7069}
7170
7271class ReadMoreButton extends StatelessWidget {
73- final Function onPressed;
72+ final VoidCallback onPressed;
7473
7574 const ReadMoreButton ({Key ? key, required this .onPressed}) : super (key: key);
7675
7776 @override
7877 Widget build (BuildContext context) {
79- bool hover = false ;
80- return StatefulBuilder (
81- builder: (BuildContext context, StateSetter setState) {
82- return MouseRegion (
83- onHover: (event) => setState (() => hover = true ),
84- onExit: (event) => setState (() => hover = false ),
85- child: OutlineButton (
86- onPressed: onPressed as void Function ()? ,
87- highlightedBorderColor: textPrimary,
88- hoverColor: textPrimary,
89- borderSide: BorderSide (color: textPrimary, width: 2 ),
90- padding: EdgeInsets .symmetric (horizontal: 20 ),
91- child: Text (
92- "READ MORE" ,
93- style: GoogleFonts .montserrat (
78+ return OutlinedButton (
79+ onPressed: onPressed,
80+ style: ButtonStyle (
81+ overlayColor: MaterialStateProperty .all <Color >(textPrimary),
82+ side: MaterialStateProperty .resolveWith ((states) {
83+ if (states.contains (MaterialState .focused) ||
84+ states.contains (MaterialState .hovered) ||
85+ states.contains (MaterialState .pressed)) {
86+ return const BorderSide (color: textPrimary, width: 2 );
87+ }
88+
89+ return const BorderSide (color: textPrimary, width: 2 );
90+ }),
91+ foregroundColor: MaterialStateProperty .resolveWith <Color >((states) {
92+ if (states.contains (MaterialState .focused) ||
93+ states.contains (MaterialState .hovered) ||
94+ states.contains (MaterialState .pressed)) {
95+ return Colors .white;
96+ }
97+
98+ return textPrimary;
99+ }),
100+ textStyle: MaterialStateProperty .resolveWith <TextStyle >((states) {
101+ if (states.contains (MaterialState .focused) ||
102+ states.contains (MaterialState .hovered) ||
103+ states.contains (MaterialState .pressed)) {
104+ return GoogleFonts .montserrat (
94105 textStyle: TextStyle (
95- fontSize: 14 ,
96- color: hover ? Colors .white : textPrimary,
97- letterSpacing: 1 ),
98- ),
99- ),
100- ),
101- );
102- });
106+ fontSize: 14 , color: Colors .white, letterSpacing: 1 ),
107+ );
108+ }
109+
110+ return GoogleFonts .montserrat (
111+ textStyle:
112+ TextStyle (fontSize: 14 , color: textPrimary, letterSpacing: 1 ),
113+ );
114+ }),
115+ padding: MaterialStateProperty .all <EdgeInsetsGeometry >(
116+ const EdgeInsets .symmetric (horizontal: 12 , vertical: 16 )),
117+ ),
118+ child: Text (
119+ "READ MORE" ,
120+ ),
121+ );
103122 }
104123}
105124
@@ -116,8 +135,7 @@ Widget dividerSmall = Container(
116135 ),
117136);
118137
119- List <Widget > authorSection (
120- {required String imageUrl, String ? name, String ? bio}) {
138+ List <Widget > authorSection ({String ? imageUrl, String ? name, String ? bio}) {
121139 return [
122140 divider,
123141 Container (
0 commit comments