Skip to content

Commit

Permalink
Add documentation for widgets (#48)
Browse files Browse the repository at this point in the history
* Fix separator throwing error in row

* Document badge

* Document button

* Document card

* Document dialog

* Document header

* Add documentation for remaining widgets

* Commit from GitHub Actions (Forui Presubmit)

* Fix golden images

* Commit from GitHub Actions (Forui Samples Presubmit)

* Fix gitignore

* Commit from GitHub Actions (Forui Samples Presubmit)

---------

Co-authored-by: Pante <[email protected]>
  • Loading branch information
Pante and Pante authored Jun 23, 2024
1 parent 8fa6723 commit 4d6891a
Show file tree
Hide file tree
Showing 105 changed files with 1,265 additions and 618 deletions.
6 changes: 3 additions & 3 deletions forui/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ class _ExampleWidgetState extends State<ExampleWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
FButton(
design: FButtonVariant.destructive,
style: FButtonStyle.destructive,
label: 'Delete?',
onPress: () => showAdaptiveDialog(
context: context,
builder: (context) => FDialog(
alignment: FDialogAlignment.horizontal,
direction: Axis.horizontal,
title: 'Are you absolutely sure?',
body: 'This action cannot be undone. This will permanently delete your account and remove your data from our servers.',
actions: [
FButton(design: FButtonVariant.outline, label: 'Cancel', onPress: () {
FButton(style: FButtonStyle.outline, label: 'Cancel', onPress: () {
Navigator.of(context).pop();
}),
FButton(label: 'Continue', onPress: () {}),
Expand Down
4 changes: 2 additions & 2 deletions forui/lib/forui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export 'src/theme/typography.dart';
export 'src/theme/themes.dart';

// Widgets
export 'src/widgets/badge/badge.dart' hide FBadgeContent;
export 'src/widgets/badge/badge.dart' hide FBadgeContent, Variant;
export 'src/foundation/tappable.dart' hide FTappable;
export 'src/widgets/button/button.dart' hide FButtonContent;
export 'src/widgets/button/button.dart' hide FButtonContent, Variant;
export 'src/widgets/card/card.dart' hide FCardContent;
export 'src/widgets/dialog/dialog.dart' hide FDialogContent, FHorizontalDialogContent, FVerticalDialogContent;
export 'src/widgets/header/header.dart';
Expand Down
2 changes: 1 addition & 1 deletion forui/lib/src/theme/color_scheme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ final class FColorScheme with Diagnosticable {
required this.border,
});

/// Creates a copy of this [FColorScheme] with the given properties replaced.
/// Returns a copy of this [FColorScheme] with the given properties replaced.
///
/// ```dart
/// final scheme = FColorScheme(
Expand Down
2 changes: 1 addition & 1 deletion forui/lib/src/theme/style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class FStyle with Diagnosticable {
this.borderWidth = 1,
});

/// Creates a copy of this [FStyle] with the given properties replaced.
/// Returns a copy of this [FStyle] with the given properties replaced.
///
/// ```dart
/// final style = FStyle(
Expand Down
6 changes: 3 additions & 3 deletions forui/lib/src/theme/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ class FTheme extends StatelessWidget {
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty<FThemeData>('data', data, showName: false))
..add(EnumProperty<TextDirection?>('textDirection', textDirection));
..add(DiagnosticsProperty('data', data, showName: false))
..add(EnumProperty('textDirection', textDirection));
}
}

Expand All @@ -132,7 +132,7 @@ class _InheritedTheme extends InheritedWidget {
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<FThemeData>('data', data));
properties.add(DiagnosticsProperty('data', data));
}
}

Expand Down
2 changes: 1 addition & 1 deletion forui/lib/src/theme/theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ final class FThemeData with Diagnosticable {
separatorStyles = FSeparatorStyles.inherit(colorScheme: colorScheme, style: style),
switchStyle = FSwitchStyle.inherit(colorScheme: colorScheme);

/// Creates a copy of this [FThemeData] with the given properties replaced.
/// Returns a copy of this [FThemeData] with the given properties replaced.
///
/// ```dart
/// final foo = FTypography();
Expand Down
36 changes: 18 additions & 18 deletions forui/lib/src/theme/typography.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,133 +20,133 @@ final class FTypography with Diagnosticable {
/// The default font family. Defaults to [`packages/forui/Inter`](https://fonts.google.com/specimen/Inter).
///
/// ## Contract:
/// Throws an [AssertionError] if empty.
/// Throws [AssertionError] if empty.
final String defaultFontFamily;

/// A value used to scale [TextStyle.fontSize]. Defaults to 1.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `sizeScalar` <= 0.0
/// * `sizeScalar` is NaN
final double sizeScalar;

/// A value used to scale [TextStyle.letterSpacing]. Defaults to 1.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `letterSpacingScalar` <= 0.0
/// * `letterSpacingScalar` is NaN
final double letterSpacingScalar;

/// A value used to scale [TextStyle.wordSpacing]. Defaults to 1.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `wordSpacingScalar` <= 0.0
/// * `wordSpacingScalar` is NaN
final double wordSpacingScalar;

/// A value used to scale [TextStyle.height]. Defaults to 1.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `heightScalar` <= 0.0
/// * `heightScalar` is NaN
final double heightScalar;

/// The font size for extra small text. Defaults to 12.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `xs` <= 0.0
/// * `xs` is NaN
final double xs;

/// The font size for small text. Defaults to 14.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `sm` <= 0.0
/// * `sm` is NaN
final double sm;

/// The font size for base text. Defaults to 16.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `base` <= 0.0
/// * `base` is NaN
final double base;

/// The font size for large text. Defaults to 18.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `lg` <= 0.0
/// * `lg` is NaN
final double lg;

/// The font size for extra large text. Defaults to 20.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `xl` <= 0.0
/// * `xl` is NaN
final double xl;

/// The font size for extra large text. Defaults to 22.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `xl2` <= 0.0
/// * `xl2` is NaN
final double xl2;

/// The font size for extra large text. Defaults to 30.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `xl3` <= 0.0
/// * `xl3` is NaN
final double xl3;

/// The font size for extra large text. Defaults to 36.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `xl4` <= 0.0
/// * `xl4` is NaN
final double xl4;

/// The font size for extra large text. Defaults to 48.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `xl5` <= 0.0
/// * `xl5` is NaN
final double xl5;

/// The font size for extra large text. Defaults to 60.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `xl6` <= 0.0
/// * `xl6` is NaN
final double xl6;

/// The font size for extra large text. Defaults to 72.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `xl7` <= 0.0
/// * `xl7` is NaN
final double xl7;

/// The font size for extra large text. Defaults to 96.
///
/// ## Contract:
/// Throws an [AssertionError] if:
/// Throws [AssertionError] if:
/// * `xl8` <= 0.0
/// * `xl8` is NaN
final double xl8;
Expand Down Expand Up @@ -189,7 +189,7 @@ final class FTypography with Diagnosticable {
assert(0 < xl7, 'The xl7 is $xl7, but it should be in the range "0 < xl7".'),
assert(0 < xl8, 'The xl8 is $xl8, but it should be in the range "0 < xl8".');

/// Creates a copy of this [FTypography] with the given properties replaced.
/// Returns a copy of this [FTypography] with the given properties replaced.
///
/// ```dart
/// const typography = FTypography(
Expand Down
Loading

0 comments on commit 4d6891a

Please sign in to comment.