chore: rename theme data

This commit is contained in:
Richard Shiue 2025-04-16 22:15:33 +08:00
parent a66fa0313f
commit 338fb2ac7e
8 changed files with 26 additions and 26 deletions

View file

@ -202,7 +202,7 @@ enum AFTextFieldSize {
m,
l;
EdgeInsetsGeometry contentPadding(AppFlowyBaseThemeData theme) {
EdgeInsetsGeometry contentPadding(AppFlowyThemeData theme) {
return EdgeInsets.symmetric(
vertical: switch (this) {
AFTextFieldSize.m => theme.spacing.s,
@ -212,7 +212,7 @@ enum AFTextFieldSize {
);
}
BorderRadius borderRadius(AppFlowyBaseThemeData theme) {
BorderRadius borderRadius(AppFlowyThemeData theme) {
return BorderRadius.circular(
switch (this) {
AFTextFieldSize.m => theme.borderRadius.m,

View file

@ -6,17 +6,17 @@ import 'package:flutter/material.dart';
class AppFlowyTheme extends ThemeExtension<AppFlowyTheme> {
const AppFlowyTheme({required this.themeData});
static AppFlowyBaseThemeData of(BuildContext context) =>
static AppFlowyThemeData of(BuildContext context) =>
Theme.of(context).extension<AppFlowyTheme>()!.themeData;
static AppFlowyBaseThemeData? maybeOf(BuildContext context) =>
static AppFlowyThemeData? maybeOf(BuildContext context) =>
Theme.of(context).extension<AppFlowyTheme>()?.themeData;
final AppFlowyBaseThemeData themeData;
final AppFlowyThemeData themeData;
@override
ThemeExtension<AppFlowyTheme> copyWith({
AppFlowyBaseThemeData? themeData,
AppFlowyThemeData? themeData,
}) {
return AppFlowyTheme(
themeData: themeData ?? this.themeData,

View file

@ -3,7 +3,7 @@
// AUTO-GENERATED - DO NOT EDIT DIRECTLY
//
// This file is auto-generated by the generate_theme.dart script
// Generation time: 2025-04-16T15:59:51.993312
// Generation time: 2025-04-16T22:13:33.297893
//
// To modify these colors, edit the source JSON files and run the script:
//

View file

@ -3,7 +3,7 @@
// AUTO-GENERATED - DO NOT EDIT DIRECTLY
//
// This file is auto-generated by the generate_theme.dart script
// Generation time: 2025-04-16T15:59:52.002683
// Generation time: 2025-04-16T22:13:33.307397
//
// To modify these colors, edit the source JSON files and run the script:
//
@ -17,7 +17,7 @@ import 'primitive.dart';
class AppFlowyDefaultTheme implements AppFlowyThemeBuilder {
@override
AppFlowyBaseThemeData light() {
AppFlowyThemeData light() {
final textStyle = AppFlowyBaseTextStyle();
final borderRadius = AppFlowySharedTokens.buildBorderRadius();
final spacing = AppFlowySharedTokens.buildSpacing();
@ -154,7 +154,7 @@ class AppFlowyDefaultTheme implements AppFlowyThemeBuilder {
textHighlight: AppFlowyPrimitiveTokens.blue200,
);
return AppFlowyBaseThemeData(
return AppFlowyThemeData(
textStyle: textStyle,
textColorScheme: textColorScheme,
borderColorScheme: borderColorScheme,
@ -171,7 +171,7 @@ class AppFlowyDefaultTheme implements AppFlowyThemeBuilder {
}
@override
AppFlowyBaseThemeData dark() {
AppFlowyThemeData dark() {
final textStyle = AppFlowyBaseTextStyle();
final borderRadius = AppFlowySharedTokens.buildBorderRadius();
final spacing = AppFlowySharedTokens.buildSpacing();
@ -308,7 +308,7 @@ class AppFlowyDefaultTheme implements AppFlowyThemeBuilder {
textHighlight: AppFlowyPrimitiveTokens.blue200,
);
return AppFlowyBaseThemeData(
return AppFlowyThemeData(
textStyle: textStyle,
textColorScheme: textColorScheme,
borderColorScheme: borderColorScheme,

View file

@ -10,14 +10,14 @@ class CustomTheme implements AppFlowyThemeBuilder {
final Map<String, dynamic> darkThemeJson;
@override
AppFlowyBaseThemeData dark() {
// TODO: implement dark
AppFlowyThemeData light() {
// TODO: implement light
throw UnimplementedError();
}
@override
AppFlowyBaseThemeData light() {
// TODO: implement light
AppFlowyThemeData dark() {
// TODO: implement dark
throw UnimplementedError();
}
}

View file

@ -4,8 +4,8 @@ import 'shadow/shadow.dart';
import 'spacing/spacing.dart';
import 'text_style/text_style.dart';
class AppFlowyBaseThemeData {
const AppFlowyBaseThemeData({
class AppFlowyThemeData {
const AppFlowyThemeData({
required this.textColorScheme,
required this.textStyle,
required this.iconColorScheme,
@ -44,11 +44,11 @@ class AppFlowyBaseThemeData {
final AppFlowyOtherColorsColorScheme otherColorsColorScheme;
AppFlowyBaseThemeData lerp(
AppFlowyBaseThemeData other,
AppFlowyThemeData lerp(
AppFlowyThemeData other,
double t,
) {
return AppFlowyBaseThemeData(
return AppFlowyThemeData(
textColorScheme: textColorScheme.lerp(other.textColorScheme, t),
textStyle: other.textStyle,
iconColorScheme: iconColorScheme.lerp(other.iconColorScheme, t),
@ -70,6 +70,6 @@ class AppFlowyBaseThemeData {
abstract class AppFlowyThemeBuilder {
const AppFlowyThemeBuilder();
AppFlowyBaseThemeData light();
AppFlowyBaseThemeData dark();
AppFlowyThemeData light();
AppFlowyThemeData dark();
}

View file

@ -2,7 +2,7 @@ export 'appflowy_theme.dart';
export 'data/built_in_themes.dart';
export 'definition/border_radius/border_radius.dart';
export 'definition/color_scheme/color_scheme.dart';
export 'definition/base_theme.dart';
export 'definition/theme_data.dart';
export 'definition/spacing/spacing.dart';
export 'definition/shadow/shadow.dart';
export 'definition/text_style/text_style.dart';

View file

@ -99,7 +99,7 @@ class AppFlowyDefaultTheme implements AppFlowyThemeBuilder {''');
void writeThemeFactory(String brightness, Map<String, dynamic> jsonData) {
buffer.writeln('''
@override
AppFlowyBaseThemeData $brightness() {
AppFlowyThemeData $brightness() {
final textStyle = AppFlowyBaseTextStyle();
final borderRadius = AppFlowySharedTokens.buildBorderRadius();
final spacing = AppFlowySharedTokens.buildSpacing();
@ -151,7 +151,7 @@ class AppFlowyDefaultTheme implements AppFlowyThemeBuilder {''');
buffer.writeln();
buffer.writeln('''
return AppFlowyBaseThemeData(
return AppFlowyThemeData(
textStyle: textStyle,
textColorScheme: textColorScheme,
borderColorScheme: borderColorScheme,