Flutterando / flutter_web_site

Flutterando's site built in Flutter Web
14 stars 9 forks source link

Create Site's Text Style and Icon Style themes #11

Closed faustobdls closed 4 years ago

faustobdls commented 4 years ago

It is a suggestion to define the styles using extesions in Text and Icon, similar to what I implemented in issue # 9 to make it more elegant, improve visibility and help with the standardization of styles.

extension TextExtension on Text{
  Text titleInCards({TextStyle style}) {
    TextStyle defaultStyle = GoogleFonts.firaCode(
      fontSize: 55,
      fontStyle: FontStyle.normal,
      letterSpacing: -0.28,
      color: ThemeData().fPrimarySwatch[300],
    );
    return Text(this.data, style: (this.style ?? defaultStyle).merge(style ?? defaultStyle));
  }
}

extension IconExtension on Icon {
  Icon rapidLinks() {
    return Icon(
      this.icon,
      color: ThemeData().fWhiteColorF,
      size: 25,
    );
  }
}

For use

Text("<Vamos ser referĂȘncias juntos>").titleInCards();
Icon(Icons.add).rapidLinks();

@irvine5k what do you think?

irvine5k commented 4 years ago

It's a good idea. I'll put priority in this issues to avoid conflicts in next issues.

faustobdls commented 4 years ago

ok @irvine5k thanks