Skip to content

Commit

Permalink
Format code using dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
Pante committed Jun 26, 2024
1 parent e31aa92 commit 9926c80
Show file tree
Hide file tree
Showing 50 changed files with 802 additions and 683 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/forui_example_presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ jobs:
- run: flutter pub global activate import_sorter
- run: flutter pub global run import_sorter:main
- run: flutter pub run build_runner build --delete-conflicting-outputs
- run: dart format --line-length 120 .
- run: dart fix --apply
# We format the code again since the required trailing comma lint fixes causes code to be formatted differently
- run: dart format --line-length 120 .

- uses: EndBug/add-and-commit@v9
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/forui_presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ jobs:
- run: flutter pub global activate import_sorter
- run: flutter pub global run import_sorter:main
- run: flutter pub run build_runner build --delete-conflicting-outputs
- run: dart format --line-length 120 .
- run: dart fix --apply
# We format the code again since the required trailing comma lint fixes causes code to be formatted differently
- run: dart format --line-length 120 .

- uses: EndBug/add-and-commit@v9
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/samples_presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ jobs:
- run: flutter pub global activate import_sorter
- run: flutter pub global run import_sorter:main
- run: flutter pub run build_runner build --delete-conflicting-outputs
- run: dart format --line-length 120 .
- run: dart fix --apply
# We format the code again since the required trailing comma lint fixes causes code to be formatted differently
- run: dart format --line-length 120 .

- uses: EndBug/add-and-commit@v9
with:
Expand Down
4 changes: 4 additions & 0 deletions forui/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ include: package:flint/analysis_options.flutter.yaml
analyzer:
errors:
unused_result: ignore

linter:
rules:
- require_trailing_commas
22 changes: 0 additions & 22 deletions forui/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,6 @@ class _ExampleWidgetState extends State<ExampleWidget> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// FButton(
// style: FButtonStyle.destructive,
// label: 'Delete?',
// onPress: () => showAdaptiveDialog(
// context: context,
// builder: (context) => FDialog(
// 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(
// style: FButtonStyle.outline,
// label: 'Cancel',
// onPress: () {
// Navigator.of(context).pop();
// }),
// FButton(label: 'Continue', onPress: () {}),
// ],
// ),
// ),
// ),
const SizedBox(height: 10),
Expanded(
child: FTabs(
Expand Down
9 changes: 5 additions & 4 deletions forui/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,12 @@ packages:
source: path
version: "0.1.0"
forui_assets:
dependency: "direct main"
dependency: transitive
description:
path: "../../forui_assets"
relative: true
source: path
name: forui_assets
sha256: a68dcbb7e6f669f495a0bcf6464f6e28197744318aabeb28aa0bb3c8435cde14
url: "https://pub.dev"
source: hosted
version: "0.1.0"
frontend_server_client:
dependency: transitive
Expand Down
2 changes: 0 additions & 2 deletions forui/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ dependencies:
sdk: flutter
forui:
path: ../
forui_assets:
path: ../../forui_assets
sugar: ^3.1.0

dev_dependencies:
Expand Down
135 changes: 65 additions & 70 deletions forui/lib/src/foundation/tappable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import 'package:flutter/material.dart';
import 'package:meta/meta.dart';

/// A [FTappable] creates a scale animation that mimics a tap.
@internal class FTappable extends StatefulWidget {
@internal
class FTappable extends StatefulWidget {
/// A pointer that might cause a tap with a primary button has contacted the
/// screen at a particular location.
///
Expand Down Expand Up @@ -527,75 +528,69 @@ import 'package:meta/meta.dart';
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(ObjectFlagProperty<VoidCallback?>.has('onTap', onTap))
..add(EnumProperty<HitTestBehavior?>('behavior', behavior))
..add(EnumProperty<DragStartBehavior?>('dragStartBehavior', dragStartBehavior))
..add(DiagnosticsProperty<bool>('excludeFromSemantics', excludeFromSemantics))
..add(ObjectFlagProperty<VoidCallback?>.has('onDoubleTap', onDoubleTap))
..add(ObjectFlagProperty<VoidCallback?>.has('onDoubleTapCancel', onDoubleTapCancel))
..add(ObjectFlagProperty<void Function(TapDownDetails p1)?>.has('onDoubleTapDown', onDoubleTapDown))
..add(ObjectFlagProperty<GestureTapDownCallback?>.has('onTapDown', onTapDown))
..add(ObjectFlagProperty<GestureTapUpCallback?>.has('onTapUp', onTapUp))
..add(ObjectFlagProperty<GestureTapCancelCallback?>.has('onTapCancel', onTapCancel))
..add(ObjectFlagProperty<GestureTapCallback?>.has('onSecondaryTap', onSecondaryTap))
..add(ObjectFlagProperty<GestureTapDownCallback?>.has('onSecondaryTapDown', onSecondaryTapDown))
..add(ObjectFlagProperty<GestureTapUpCallback?>.has('onSecondaryTapUp', onSecondaryTapUp))
..add(ObjectFlagProperty<GestureTapCancelCallback?>.has('onSecondaryTapCancel', onSecondaryTapCancel))
..add(ObjectFlagProperty<GestureTapDownCallback?>.has('onTertiaryTapDown', onTertiaryTapDown))
..add(ObjectFlagProperty<GestureTapUpCallback?>.has('onTertiaryTapUp', onTertiaryTapUp))
..add(ObjectFlagProperty<GestureTapCancelCallback?>.has('onTertiaryTapCancel', onTertiaryTapCancel))
..add(ObjectFlagProperty<GestureLongPressDownCallback?>.has('onLongPressDown', onLongPressDown))
..add(ObjectFlagProperty<GestureLongPressCancelCallback?>.has('onLongPressCancel', onLongPressCancel))
..add(ObjectFlagProperty<GestureLongPressCallback?>.has('onLongPress', onLongPress))
..add(ObjectFlagProperty<GestureLongPressStartCallback?>.has('onLongPressStart', onLongPressStart))
..add(ObjectFlagProperty<GestureLongPressMoveUpdateCallback?>.has('onLongPressMoveUpdate', onLongPressMoveUpdate))
..add(ObjectFlagProperty<GestureLongPressUpCallback?>.has('onLongPressUp', onLongPressUp))
..add(ObjectFlagProperty<GestureLongPressEndCallback?>.has('onLongPressEnd', onLongPressEnd))
..add(ObjectFlagProperty<GestureLongPressDownCallback?>.has('onSecondaryLongPressDown', onSecondaryLongPressDown))
..add(ObjectFlagProperty<GestureLongPressCancelCallback?>.has(
'onSecondaryLongPressCancel', onSecondaryLongPressCancel))
..add(ObjectFlagProperty<GestureLongPressCallback?>.has('onSecondaryLongPress', onSecondaryLongPress))
..add(ObjectFlagProperty<GestureLongPressStartCallback?>.has(
'onSecondaryLongPressStart', onSecondaryLongPressStart))
..add(ObjectFlagProperty<GestureLongPressMoveUpdateCallback?>.has(
'onSecondaryLongPressMoveUpdate', onSecondaryLongPressMoveUpdate))
..add(ObjectFlagProperty<GestureLongPressUpCallback?>.has('onSecondaryLongPressUp', onSecondaryLongPressUp))
..add(ObjectFlagProperty<GestureLongPressEndCallback?>.has('onSecondaryLongPressEnd', onSecondaryLongPressEnd))
..add(ObjectFlagProperty<GestureLongPressDownCallback?>.has('onTertiaryLongPressDown', onTertiaryLongPressDown))
..add(ObjectFlagProperty<GestureLongPressCancelCallback?>.has(
'onTertiaryLongPressCancel', onTertiaryLongPressCancel))
..add(ObjectFlagProperty<GestureLongPressCallback?>.has('onTertiaryLongPress', onTertiaryLongPress))
..add(
ObjectFlagProperty<GestureLongPressStartCallback?>.has('onTertiaryLongPressStart', onTertiaryLongPressStart))
..add(ObjectFlagProperty<GestureLongPressMoveUpdateCallback?>.has(
'onTertiaryLongPressMoveUpdate', onTertiaryLongPressMoveUpdate))
..add(ObjectFlagProperty<GestureLongPressUpCallback?>.has('onTertiaryLongPressUp', onTertiaryLongPressUp))
..add(ObjectFlagProperty<GestureLongPressEndCallback?>.has('onTertiaryLongPressEnd', onTertiaryLongPressEnd))
..add(ObjectFlagProperty<GestureDragDownCallback?>.has('onVerticalDragDown', onVerticalDragDown))
..add(ObjectFlagProperty<GestureDragStartCallback?>.has('onVerticalDragStart', onVerticalDragStart))
..add(ObjectFlagProperty<GestureDragUpdateCallback?>.has('onVerticalDragUpdate', onVerticalDragUpdate))
..add(ObjectFlagProperty<GestureDragEndCallback?>.has('onVerticalDragEnd', onVerticalDragEnd))
..add(ObjectFlagProperty<GestureDragCancelCallback?>.has('onVerticalDragCancel', onVerticalDragCancel))
..add(ObjectFlagProperty<GestureDragDownCallback?>.has('onHorizontalDragDown', onHorizontalDragDown))
..add(ObjectFlagProperty<GestureDragStartCallback?>.has('onHorizontalDragStart', onHorizontalDragStart))
..add(ObjectFlagProperty<GestureDragUpdateCallback?>.has('onHorizontalDragUpdate', onHorizontalDragUpdate))
..add(ObjectFlagProperty<GestureDragEndCallback?>.has('onHorizontalDragEnd', onHorizontalDragEnd))
..add(ObjectFlagProperty<GestureDragCancelCallback?>.has('onHorizontalDragCancel', onHorizontalDragCancel))
..add(ObjectFlagProperty<GestureDragDownCallback?>.has('onPanDown', onPanDown))
..add(ObjectFlagProperty<GestureDragStartCallback?>.has('onPanStart', onPanStart))
..add(ObjectFlagProperty<GestureDragUpdateCallback?>.has('onPanUpdate', onPanUpdate))
..add(ObjectFlagProperty<GestureDragEndCallback?>.has('onPanEnd', onPanEnd))
..add(ObjectFlagProperty<GestureDragCancelCallback?>.has('onPanCancel', onPanCancel))
..add(ObjectFlagProperty<GestureScaleStartCallback?>.has('onScaleStart', onScaleStart))
..add(ObjectFlagProperty<GestureScaleUpdateCallback?>.has('onScaleUpdate', onScaleUpdate))
..add(ObjectFlagProperty<GestureScaleEndCallback?>.has('onScaleEnd', onScaleEnd))
..add(ObjectFlagProperty<GestureForcePressStartCallback?>.has('onForcePressStart', onForcePressStart))
..add(ObjectFlagProperty<GestureForcePressPeakCallback?>.has('onForcePressPeak', onForcePressPeak))
..add(ObjectFlagProperty<GestureForcePressUpdateCallback?>.has('onForcePressUpdate', onForcePressUpdate))
..add(ObjectFlagProperty<GestureForcePressEndCallback?>.has('onForcePressEnd', onForcePressEnd))
..add(IterableProperty<PointerDeviceKind>('supportedDevices', supportedDevices))
..add(DiagnosticsProperty<bool>('trackpadScrollCausesScale', trackpadScrollCausesScale))
..add(DiagnosticsProperty<Offset>('trackpadScrollToScaleFactor', trackpadScrollToScaleFactor));
..add(ObjectFlagProperty.has('onTap', onTap))
..add(EnumProperty('behavior', behavior))
..add(EnumProperty('dragStartBehavior', dragStartBehavior))
..add(DiagnosticsProperty('excludeFromSemantics', excludeFromSemantics))
..add(ObjectFlagProperty.has('onDoubleTap', onDoubleTap))
..add(ObjectFlagProperty.has('onDoubleTapCancel', onDoubleTapCancel))
..add(ObjectFlagProperty.has('onDoubleTapDown', onDoubleTapDown))
..add(ObjectFlagProperty.has('onTapDown', onTapDown))
..add(ObjectFlagProperty.has('onTapUp', onTapUp))
..add(ObjectFlagProperty.has('onTapCancel', onTapCancel))
..add(ObjectFlagProperty.has('onSecondaryTap', onSecondaryTap))
..add(ObjectFlagProperty.has('onSecondaryTapDown', onSecondaryTapDown))
..add(ObjectFlagProperty.has('onSecondaryTapUp', onSecondaryTapUp))
..add(ObjectFlagProperty.has('onSecondaryTapCancel', onSecondaryTapCancel))
..add(ObjectFlagProperty.has('onTertiaryTapDown', onTertiaryTapDown))
..add(ObjectFlagProperty.has('onTertiaryTapUp', onTertiaryTapUp))
..add(ObjectFlagProperty.has('onTertiaryTapCancel', onTertiaryTapCancel))
..add(ObjectFlagProperty.has('onLongPressDown', onLongPressDown))
..add(ObjectFlagProperty.has('onLongPressCancel', onLongPressCancel))
..add(ObjectFlagProperty.has('onLongPress', onLongPress))
..add(ObjectFlagProperty.has('onLongPressStart', onLongPressStart))
..add(ObjectFlagProperty.has('onLongPressMoveUpdate', onLongPressMoveUpdate))
..add(ObjectFlagProperty.has('onLongPressUp', onLongPressUp))
..add(ObjectFlagProperty.has('onLongPressEnd', onLongPressEnd))
..add(ObjectFlagProperty.has('onSecondaryLongPressDown', onSecondaryLongPressDown))
..add(ObjectFlagProperty.has('onSecondaryLongPressCancel', onSecondaryLongPressCancel))
..add(ObjectFlagProperty.has('onSecondaryLongPress', onSecondaryLongPress))
..add(ObjectFlagProperty.has('onSecondaryLongPressStart', onSecondaryLongPressStart))
..add(ObjectFlagProperty.has('onSecondaryLongPressMoveUpdate', onSecondaryLongPressMoveUpdate))
..add(ObjectFlagProperty.has('onSecondaryLongPressUp', onSecondaryLongPressUp))
..add(ObjectFlagProperty.has('onSecondaryLongPressEnd', onSecondaryLongPressEnd))
..add(ObjectFlagProperty.has('onTertiaryLongPressDown', onTertiaryLongPressDown))
..add(ObjectFlagProperty.has('onTertiaryLongPressCancel', onTertiaryLongPressCancel))
..add(ObjectFlagProperty.has('onTertiaryLongPress', onTertiaryLongPress))
..add(ObjectFlagProperty.has('onTertiaryLongPressStart', onTertiaryLongPressStart))
..add(ObjectFlagProperty.has('onTertiaryLongPressMoveUpdate', onTertiaryLongPressMoveUpdate))
..add(ObjectFlagProperty.has('onTertiaryLongPressUp', onTertiaryLongPressUp))
..add(ObjectFlagProperty.has('onTertiaryLongPressEnd', onTertiaryLongPressEnd))
..add(ObjectFlagProperty.has('onVerticalDragDown', onVerticalDragDown))
..add(ObjectFlagProperty.has('onVerticalDragStart', onVerticalDragStart))
..add(ObjectFlagProperty.has('onVerticalDragUpdate', onVerticalDragUpdate))
..add(ObjectFlagProperty.has('onVerticalDragEnd', onVerticalDragEnd))
..add(ObjectFlagProperty.has('onVerticalDragCancel', onVerticalDragCancel))
..add(ObjectFlagProperty.has('onHorizontalDragDown', onHorizontalDragDown))
..add(ObjectFlagProperty.has('onHorizontalDragStart', onHorizontalDragStart))
..add(ObjectFlagProperty.has('onHorizontalDragUpdate', onHorizontalDragUpdate))
..add(ObjectFlagProperty.has('onHorizontalDragEnd', onHorizontalDragEnd))
..add(ObjectFlagProperty.has('onHorizontalDragCancel', onHorizontalDragCancel))
..add(ObjectFlagProperty.has('onPanDown', onPanDown))
..add(ObjectFlagProperty.has('onPanStart', onPanStart))
..add(ObjectFlagProperty.has('onPanUpdate', onPanUpdate))
..add(ObjectFlagProperty.has('onPanEnd', onPanEnd))
..add(ObjectFlagProperty.has('onPanCancel', onPanCancel))
..add(ObjectFlagProperty.has('onScaleStart', onScaleStart))
..add(ObjectFlagProperty.has('onScaleUpdate', onScaleUpdate))
..add(ObjectFlagProperty.has('onScaleEnd', onScaleEnd))
..add(ObjectFlagProperty.has('onForcePressStart', onForcePressStart))
..add(ObjectFlagProperty.has('onForcePressPeak', onForcePressPeak))
..add(ObjectFlagProperty.has('onForcePressUpdate', onForcePressUpdate))
..add(ObjectFlagProperty.has('onForcePressEnd', onForcePressEnd))
..add(IterableProperty('supportedDevices', supportedDevices))
..add(DiagnosticsProperty('trackpadScrollCausesScale', trackpadScrollCausesScale))
..add(DiagnosticsProperty('trackpadScrollToScaleFactor', trackpadScrollToScaleFactor));
}
}

Expand Down
3 changes: 2 additions & 1 deletion forui/lib/src/theme/color_scheme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ final class FColorScheme with Diagnosticable {
/// print(copy.brightness); // Brightness.dark
/// print(copy.background); // Colors.blue
/// ```
@useResult FColorScheme copyWith({
@useResult
FColorScheme copyWith({
Brightness? brightness,
Color? background,
Color? foreground,
Expand Down
4 changes: 2 additions & 2 deletions forui/lib/src/theme/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FTheme extends StatelessWidget {
///
/// ## Troubleshooting:
///
/// ### [FTheme.of] always returns [FThemes.zinc.light]
/// ### [FTheme.of] always returns `FThemes.zinc.light`
///
/// One of the most common causes is calling [FTheme.of] in the same context which [FTheme] was declared. To fix this,
/// move the call to [FTheme.of] to a descendant widget.
Expand Down Expand Up @@ -139,7 +139,7 @@ class _InheritedTheme extends InheritedWidget {

/// Provides functions for accessing the current [FThemeData].
extension ThemeBuildContext on BuildContext {
/// Returns the current [FThemeData], or [FThemes.zinc.light] if there is no ancestor [FTheme].
/// Returns the current [FThemeData], or `FThemes.zinc.light` if there is no ancestor [FTheme].
///
/// ## Troubleshooting:
///
Expand Down
58 changes: 29 additions & 29 deletions forui/lib/src/theme/typography.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,20 @@ final class FTypography with Diagnosticable {
/// ```
@useResult
FTypography scale({double sizeScalar = 1}) => FTypography(
defaultFontFamily: defaultFontFamily,
xs: _scaleTextStyle(style: xs, sizeScalar: sizeScalar),
sm: _scaleTextStyle(style: sm, sizeScalar: sizeScalar),
base: _scaleTextStyle(style: base, sizeScalar: sizeScalar),
lg: _scaleTextStyle(style: lg, sizeScalar: sizeScalar),
xl: _scaleTextStyle(style: xl, sizeScalar: sizeScalar),
xl2: _scaleTextStyle(style: xl2, sizeScalar: sizeScalar),
xl3: _scaleTextStyle(style: xl3, sizeScalar: sizeScalar),
xl4: _scaleTextStyle(style: xl4, sizeScalar: sizeScalar),
xl5: _scaleTextStyle(style: xl5, sizeScalar: sizeScalar),
xl6: _scaleTextStyle(style: xl6, sizeScalar: sizeScalar),
xl7: _scaleTextStyle(style: xl7, sizeScalar: sizeScalar),
xl8: _scaleTextStyle(style: xl8, sizeScalar: sizeScalar),
);
defaultFontFamily: defaultFontFamily,
xs: _scaleTextStyle(style: xs, sizeScalar: sizeScalar),
sm: _scaleTextStyle(style: sm, sizeScalar: sizeScalar),
base: _scaleTextStyle(style: base, sizeScalar: sizeScalar),
lg: _scaleTextStyle(style: lg, sizeScalar: sizeScalar),
xl: _scaleTextStyle(style: xl, sizeScalar: sizeScalar),
xl2: _scaleTextStyle(style: xl2, sizeScalar: sizeScalar),
xl3: _scaleTextStyle(style: xl3, sizeScalar: sizeScalar),
xl4: _scaleTextStyle(style: xl4, sizeScalar: sizeScalar),
xl5: _scaleTextStyle(style: xl5, sizeScalar: sizeScalar),
xl6: _scaleTextStyle(style: xl6, sizeScalar: sizeScalar),
xl7: _scaleTextStyle(style: xl7, sizeScalar: sizeScalar),
xl8: _scaleTextStyle(style: xl8, sizeScalar: sizeScalar),
);

TextStyle _scaleTextStyle({
required TextStyle style,
Expand Down Expand Up @@ -247,21 +247,21 @@ final class FTypography with Diagnosticable {
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is FTypography &&
runtimeType == other.runtimeType &&
defaultFontFamily == other.defaultFontFamily &&
xs == other.xs &&
sm == other.sm &&
base == other.base &&
lg == other.lg &&
xl == other.xl &&
xl2 == other.xl2 &&
xl3 == other.xl3 &&
xl4 == other.xl4 &&
xl5 == other.xl5 &&
xl6 == other.xl6 &&
xl7 == other.xl7 &&
xl8 == other.xl8;
other is FTypography &&
runtimeType == other.runtimeType &&
defaultFontFamily == other.defaultFontFamily &&
xs == other.xs &&
sm == other.sm &&
base == other.base &&
lg == other.lg &&
xl == other.xl &&
xl2 == other.xl2 &&
xl3 == other.xl3 &&
xl4 == other.xl4 &&
xl5 == other.xl5 &&
xl6 == other.xl6 &&
xl7 == other.xl7 &&
xl8 == other.xl8;

@override
int get hashCode =>
Expand Down
Loading

0 comments on commit 9926c80

Please sign in to comment.