-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
refactor: Extract AppVersionText
into a separate widget + Add a new widget = ChipText
#251
Conversation
AppVersionInfo
into a separate widgetAppVersionText
into a separate widget
AppVersionText
into a separate widgetAppVersionText
into a separate widget + Add a new widget = ChipText
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! lets just add some optional styling capabilities to the widgets
import 'package:flutter/material.dart'; | ||
|
||
class AppVersionText extends StatelessWidget { | ||
const AppVersionText({required this.appInfoProvider, Key? key}) : super(key: key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const AppVersionText({required this.appInfoProvider, Key? key}) : super(key: key); | |
const AppVersionText({required this.appInfoProvider, Key? key,}) : super(key: key); |
final AppInfoProvider appInfoProvider; | ||
|
||
@override | ||
void debugFillProperties(DiagnosticPropertiesBuilder properties) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this method should be at the bottom of the class
@override | ||
Widget build(BuildContext context) => FutureBuilder<String>( | ||
future: appInfoProvider.getAppVersion(), | ||
builder: (context, snapshot) => Text(snapshot.data ?? ''), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right now we're not able to style it, let's add another optional TextStyle?
to the constructor of AppVersionText
and pass it into this Text
widget
padding: EdgeInsets.all(theme.spacingM), | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(10), | ||
color: theme.colors.chipBackground, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make the Color? color
an optional parameter to the ChipText
widget with the default value of theme.colors.chipBackground
borderRadius: BorderRadius.circular(10), | ||
color: theme.colors.chipBackground, | ||
), | ||
child: Text(title), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add optional parameter of TextStyle?
to the ChipText
constructor and pass it to this Text
widget
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌟
No description provided.