Skip to content

Commit

Permalink
Merge pull request #194 from anderscheow/rename-text-theme
Browse files Browse the repository at this point in the history
Fixed missing material 3 text theme naming on VxText
  • Loading branch information
iampawan committed Jan 13, 2024
2 parents c5f2fbb + e3ef088 commit 0d1180b
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 75 deletions.
61 changes: 31 additions & 30 deletions lib/src/flutter/rich_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import 'package:auto_size_text_pk/auto_size_text_pk.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:velocity_x/src/extensions/context_ext.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
import 'package:velocity_x/src/flutter/builder.dart';
import 'package:velocity_x/src/flutter/velocityx_mixins/color_mixin.dart';
Expand Down Expand Up @@ -208,91 +209,91 @@ class VxRichText extends VxWidgetBuilder<Widget>

/// Sets [TextTheme] display large
VxRichText displayLarge(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.displayLarge;
_themedStyle = context.textTheme.displayLarge;
return this;
}

/// Sets [TextTheme] display medium
VxRichText displayMedium(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.displayMedium;
_themedStyle = context.textTheme.displayMedium;
return this;
}

/// Sets [TextTheme] display small
VxRichText displaySmall(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.displaySmall;
_themedStyle = context.textTheme.displaySmall;
return this;
}

/// Sets [TextTheme] headline large
VxRichText headlineLarge(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.headlineLarge;
_themedStyle = context.textTheme.headlineLarge;
return this;
}

/// Sets [TextTheme] headline medium
VxRichText headlineMedium(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.headlineMedium;
_themedStyle = context.textTheme.headlineMedium;
return this;
}

/// Sets [TextTheme] headline small
VxRichText headlineSmall(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.headlineSmall;
_themedStyle = context.textTheme.headlineSmall;
return this;
}

/// Sets [TextTheme] title large
VxRichText titleLarge(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.titleLarge;
_themedStyle = context.textTheme.titleLarge;
return this;
}

/// Sets [TextTheme] title medium
VxRichText titleMedium(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.titleMedium;
_themedStyle = context.textTheme.titleMedium;
return this;
}

/// Sets [TextTheme] title small
VxRichText titleSmall(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.titleSmall;
_themedStyle = context.textTheme.titleSmall;
return this;
}

/// Sets [TextTheme] body large
VxRichText bodyLarge(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.bodyLarge;
_themedStyle = context.textTheme.bodyLarge;
return this;
}

/// Sets [TextTheme] body medium
VxRichText bodyMedium(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.bodyMedium;
_themedStyle = context.textTheme.bodyMedium;
return this;
}

/// Sets [TextTheme] body small
VxRichText bodySmall(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.bodySmall;
_themedStyle = context.textTheme.bodySmall;
return this;
}

/// Sets [TextTheme] label large
VxRichText labelLarge(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.labelLarge;
_themedStyle = context.textTheme.labelLarge;
return this;
}

/// Sets [TextTheme] label medium
VxRichText labelMedium(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.labelMedium;
_themedStyle = context.textTheme.labelMedium;
return this;
}

/// Sets [TextTheme] label small
VxRichText labelSmall(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.labelSmall;
_themedStyle = context.textTheme.labelSmall;
return this;
}

Expand Down Expand Up @@ -576,91 +577,91 @@ class VelocityXTextSpan extends VxTextSpanBuilder

/// Sets [TextTheme] display large
VelocityXTextSpan displayLarge(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.displayLarge;
_themedStyle = context.textTheme.displayLarge;
return this;
}

/// Sets [TextTheme] display medium
VelocityXTextSpan displayMedium(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.displayMedium;
_themedStyle = context.textTheme.displayMedium;
return this;
}

/// Sets [TextTheme] display small
VelocityXTextSpan displaySmall(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.displaySmall;
_themedStyle = context.textTheme.displaySmall;
return this;
}

/// Sets [TextTheme] headline large
VelocityXTextSpan headlineLarge(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.headlineLarge;
_themedStyle = context.textTheme.headlineLarge;
return this;
}

/// Sets [TextTheme] headline medium
VelocityXTextSpan headlineMedium(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.headlineMedium;
_themedStyle = context.textTheme.headlineMedium;
return this;
}

/// Sets [TextTheme] headline small
VelocityXTextSpan headlineSmall(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.headlineSmall;
_themedStyle = context.textTheme.headlineSmall;
return this;
}

/// Sets [TextTheme] title large
VelocityXTextSpan titleLarge(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.titleLarge;
_themedStyle = context.textTheme.titleLarge;
return this;
}

/// Sets [TextTheme] title medium
VelocityXTextSpan titleMedium(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.titleMedium;
_themedStyle = context.textTheme.titleMedium;
return this;
}

/// Sets [TextTheme] title small
VelocityXTextSpan titleSmall(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.titleSmall;
_themedStyle = context.textTheme.titleSmall;
return this;
}

/// Sets [TextTheme] body large
VelocityXTextSpan bodyLarge(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.bodyLarge;
_themedStyle = context.textTheme.bodyLarge;
return this;
}

/// Sets [TextTheme] body medium
VelocityXTextSpan bodyMedium(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.bodyMedium;
_themedStyle = context.textTheme.bodyMedium;
return this;
}

/// Sets [TextTheme] body small
VelocityXTextSpan bodySmall(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.bodySmall;
_themedStyle = context.textTheme.bodySmall;
return this;
}

/// Sets [TextTheme] label large
VelocityXTextSpan labelLarge(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.labelLarge;
_themedStyle = context.textTheme.labelLarge;
return this;
}

/// Sets [TextTheme] label medium
VelocityXTextSpan labelMedium(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.labelMedium;
_themedStyle = context.textTheme.labelMedium;
return this;
}

/// Sets [TextTheme] label small
VelocityXTextSpan labelSmall(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.labelSmall;
_themedStyle = context.textTheme.labelSmall;
return this;
}

Expand Down
91 changes: 52 additions & 39 deletions lib/src/flutter/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import 'package:auto_size_text_pk/auto_size_text_pk.dart';
import 'package:flutter/material.dart';
import 'package:velocity_x/src/extensions/context_ext.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
import 'package:velocity_x/src/flutter/velocityx_mixins/render_mixin.dart';
import 'package:velocity_x/src/velocity_xx.dart';
Expand Down Expand Up @@ -248,81 +249,93 @@ class VxTextBuilder extends VxWidgetBuilder<Widget>
/// To set fontSize of the text using [size]
VxTextBuilder size(double? size) => this.._fontSize = size;

/// Sets [TextTheme] headline 1
VxTextBuilder headline1(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.displayLarge;
/// Sets [TextTheme] display large
VxTextBuilder displayLarge(BuildContext context) {
_themedStyle = context.textTheme.displayLarge;
return this;
}

/// Sets [TextTheme] headline 2
VxTextBuilder headline2(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.displayMedium;
/// Sets [TextTheme] display medium
VxTextBuilder displayMedium(BuildContext context) {
_themedStyle = context.textTheme.displayMedium;
return this;
}

/// Sets [TextTheme] headline 3
VxTextBuilder headline3(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.displaySmall;
/// Sets [TextTheme] display small
VxTextBuilder displaySmall(BuildContext context) {
_themedStyle = context.textTheme.displaySmall;
return this;
}

/// Sets [TextTheme] headline 4
VxTextBuilder headline4(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.headlineMedium;
/// Sets [TextTheme] headline large
VxTextBuilder headlineLarge(BuildContext context) {
_themedStyle = context.textTheme.headlineLarge;
return this;
}

/// Sets [TextTheme] headline 5
VxTextBuilder headline5(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.headlineSmall;
/// Sets [TextTheme] headline medium
VxTextBuilder headlineMedium(BuildContext context) {
_themedStyle = context.textTheme.headlineMedium;
return this;
}

/// Sets [TextTheme] headline 6
VxTextBuilder headline6(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.titleLarge;
/// Sets [TextTheme] headline small
VxTextBuilder headlineSmall(BuildContext context) {
_themedStyle = context.textTheme.headlineSmall;
return this;
}

/// Sets [TextTheme] bodyText1
VxTextBuilder bodyText1(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.bodyLarge;
/// Sets [TextTheme] title large
VxTextBuilder titleLarge(BuildContext context) {
_themedStyle = context.textTheme.titleLarge;
return this;
}

/// Sets [TextTheme] bodyText2
VxTextBuilder bodyText2(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.bodyMedium;
/// Sets [TextTheme] title medium
VxTextBuilder titleMedium(BuildContext context) {
_themedStyle = context.textTheme.titleMedium;
return this;
}

/// Sets [TextTheme] caption
VxTextBuilder caption(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.bodySmall;
/// Sets [TextTheme] title small
VxTextBuilder titleSmall(BuildContext context) {
_themedStyle = context.textTheme.titleSmall;
return this;
}

/// Sets [TextTheme] subtitle1
VxTextBuilder subtitle1(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.titleMedium;
/// Sets [TextTheme] body large
VxTextBuilder bodyLarge(BuildContext context) {
_themedStyle = context.textTheme.bodyLarge;
return this;
}

/// Sets [TextTheme] subtitle2
VxTextBuilder subtitle2(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.titleSmall;
/// Sets [TextTheme] body medium
VxTextBuilder bodyMedium(BuildContext context) {
_themedStyle = context.textTheme.bodyMedium;
return this;
}

/// Sets [TextTheme] overline
VxTextBuilder overlineText(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.labelSmall;
/// Sets [TextTheme] body small
VxTextBuilder bodySmall(BuildContext context) {
_themedStyle = context.textTheme.bodySmall;
return this;
}

/// Sets [TextTheme] button
VxTextBuilder buttonText(BuildContext context) {
_themedStyle = Theme.of(context).textTheme.labelLarge;
/// Sets [TextTheme] label large
VxTextBuilder labelLarge(BuildContext context) {
_themedStyle = context.textTheme.labelLarge;
return this;
}

/// Sets [TextTheme] label medium
VxTextBuilder labelMedium(BuildContext context) {
_themedStyle = context.textTheme.labelMedium;
return this;
}

/// Sets [TextTheme] label small
VxTextBuilder labelSmall(BuildContext context) {
_themedStyle = context.textTheme.labelSmall;
return this;
}

Expand Down
Loading

0 comments on commit 0d1180b

Please sign in to comment.