Skip to content

Commit

Permalink
style: formatted with dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
rajivmanivannan committed Feb 24, 2024
1 parent 914ee5f commit f9732f0
Show file tree
Hide file tree
Showing 17 changed files with 108 additions and 108 deletions.
2 changes: 1 addition & 1 deletion example/lib/styles/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ class AppColors {
static const Color errorHover = Color(0xffDF2036);
static const Color warningHover = Color(0xffFFAD14);
static const Color disabledBackgroundHover = Color(0x331A1B1F);
}
}
1 change: 1 addition & 0 deletions example/lib/symbol.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ enum Symbol {
sync(FluentIcons.arrow_sync_circle_24_regular),
tabs(FluentIcons.tabs_24_regular),
hamburgerMenu(FluentIcons.line_horizontal_3_20_filled);

final IconData value;

const Symbol(this.value);
Expand Down
2 changes: 1 addition & 1 deletion lib/components/badge/badge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ class TUIBadge extends StatelessWidget {
);
}
}
}
}
2 changes: 1 addition & 1 deletion lib/components/button/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TUIButton extends StatelessWidget {
required this.onPressed,
this.onLongPress,
this.height,
}) : assert(label != null || iconData != null);
}) : assert(label != null || iconData != null);

final TUIButtonType type;
final TUIButtonSize size;
Expand Down
1 change: 1 addition & 0 deletions lib/components/checkbox/checkbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ enum TUICheckBoxState {
unchecked(0),
mixed(1),
checked(2);

const TUICheckBoxState(this.value);
final num value;

Expand Down
1 change: 1 addition & 0 deletions lib/components/checkbox_row/checkbox_row.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/material.dart';
import 'package:tarka_ui/styles/theme.dart';

/// TUICheckBoxRow is used to create a checkbox with label and checkbox state.
/*
Example:
Expand Down
1 change: 1 addition & 0 deletions lib/components/chip/chip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:tarka_ui/styles/default_colors.dart';
import 'package:tarka_ui/styles/text_style.dart';
import 'package:tarka_ui/subcomponents/image.dart';

/// TUIChip widget to display a chip with title, left icon, right icon and badge.
/*
Example:
Expand Down
19 changes: 10 additions & 9 deletions lib/components/divider/divider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ class TUIDivider extends StatelessWidget {
Widget build(BuildContext context) {
return type == TUIDividerType.horizontal
? Divider(
thickness: 2,
color: color,
indent: _getHorizontalPadding(),
endIndent: _getHorizontalPadding(),
) : VerticalDivider(
thickness: 2,
color: color,
indent: _getVerticalPadding(),
);
thickness: 2,
color: color,
indent: _getHorizontalPadding(),
endIndent: _getHorizontalPadding(),
)
: VerticalDivider(
thickness: 2,
color: color,
indent: _getVerticalPadding(),
);
}

double _getVerticalPadding() {
Expand Down
42 changes: 22 additions & 20 deletions lib/components/mobile_overlay_header/mobile_overlay_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,28 +84,30 @@ class TUIMobileOverlayHeader extends StatelessWidget {
Widget? getRightView(BuildContext context) {
return (style.style == TUIOverlayMobileStyleType.right)
? Positioned(
top: 0,
right: 0,
child: SizedBox(
width: MediaQuery.of(context).size.width, // Set the width to the screen width
child: Row(
children: [
const Spacer(),
Flexible(
fit: FlexFit.loose,
child: Center(
child: TUIIconButton(
type: TUIIconButtonType.ghost,
size: TUIIconButtonSize.px40,
iconData: style.getIcon(),
onPressed: style.action,
),
top: 0,
right: 0,
child: SizedBox(
width: MediaQuery.of(context)
.size
.width, // Set the width to the screen width
child: Row(
children: [
const Spacer(),
Flexible(
fit: FlexFit.loose,
child: Center(
child: TUIIconButton(
type: TUIIconButtonType.ghost,
size: TUIIconButtonSize.px40,
iconData: style.getIcon(),
onPressed: style.action,
),
),
),
],
),
),
],
),
),
)
)
: null;
}

Expand Down
12 changes: 6 additions & 6 deletions lib/components/navigation_row/navigation_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class TUINavigationRow extends StatelessWidget {
}

Widget getLeftView(
BuildContext context,
IconData? icon,
String title,
double maxHeight,
) {
BuildContext context,
IconData? icon,
String title,
double maxHeight,
) {
final theme = TUITheme.of(context);

TextStyle titleTextStyle = theme.typography.heading7.copyWith(
Expand Down Expand Up @@ -97,4 +97,4 @@ class TUINavigationRow extends StatelessWidget {
),
);
}
}
}
4 changes: 1 addition & 3 deletions lib/styles/typography.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/painting.dart';

class TUITypography with Diagnosticable {

final TextStyle heading1;
final TextStyle heading2;
final TextStyle heading3;
Expand All @@ -18,7 +17,6 @@ class TUITypography with Diagnosticable {
final TextStyle button7;
final TextStyle button8;


TUITypography(
this.heading1,
this.heading2,
Expand Down Expand Up @@ -54,4 +52,4 @@ class TUITypography with Diagnosticable {
..add(DiagnosticsProperty<TextStyle>('button7', button7))
..add(DiagnosticsProperty<TextStyle>('button8', button8));
}
}
}
6 changes: 2 additions & 4 deletions test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import 'defaults.dart';
void main() {
testWidgets('Should not have ripple effect', (WidgetTester tester) async {
await tester.pumpWidget(
wrapApp(
child: const SizedBox()
),
wrapApp(child: const SizedBox()),
);
BuildContext context = tester.element(find.byType(SizedBox));
final materialTheme = Theme.of(context);
expect(materialTheme.splashFactory, NoSplash.splashFactory);
});
}
}
97 changes: 48 additions & 49 deletions test/defaults.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,55 +32,54 @@ WidgetWrapper tuiAppWrapper({
TUIThemeData defaultTheme() {
return TUIThemeData(
TUIColors(
TUIDefaultColors.primary,
TUIDefaultColors.onPrimary,
TUIDefaultColors.primaryAlt,
TUIDefaultColors.onPrimaryAlt,
TUIDefaultColors.primaryHover,
TUIDefaultColors.primaryAltHover,
TUIDefaultColors.secondary,
TUIDefaultColors.onSecondary,
TUIDefaultColors.secondaryAlt,
TUIDefaultColors.onSecondaryAlt,
TUIDefaultColors.secondaryHover,
TUIDefaultColors.secondaryAltHover,
TUIDefaultColors.tertiary,
TUIDefaultColors.onTertiary,
TUIDefaultColors.tertiaryAlt,
TUIDefaultColors.onTertiaryAlt,
TUIDefaultColors.tertiaryHover,
TUIDefaultColors.tertiaryAltHover,
TUIDefaultColors.success,
TUIDefaultColors.onSuccess,
TUIDefaultColors.success10,
TUIDefaultColors.success20,
TUIDefaultColors.error,
TUIDefaultColors.onError,
TUIDefaultColors.error10,
TUIDefaultColors.errorHover,
TUIDefaultColors.warning,
TUIDefaultColors.onWarning,
TUIDefaultColors.warning10,
TUIDefaultColors.warningHover,
TUIDefaultColors.background,
TUIDefaultColors.onBackground,
TUIDefaultColors.outline,
TUIDefaultColors.disabledContent,
TUIDefaultColors.disabledBackground,
TUIDefaultColors.disabledBackgroundHover,
TUIDefaultColors.link,
TUIDefaultColors.inputText,
TUIDefaultColors.inputBackground,
TUIDefaultColors.inputTextDim,
TUIDefaultColors.surface,
TUIDefaultColors.surface50,
TUIDefaultColors.onSurface,
TUIDefaultColors.surfaceVariant,
TUIDefaultColors.surfaceHover,
TUIDefaultColors.surfaceVariantHover,
TUIDefaultColors.constantLight,
TUIDefaultColors.constantDark
),
TUIDefaultColors.primary,
TUIDefaultColors.onPrimary,
TUIDefaultColors.primaryAlt,
TUIDefaultColors.onPrimaryAlt,
TUIDefaultColors.primaryHover,
TUIDefaultColors.primaryAltHover,
TUIDefaultColors.secondary,
TUIDefaultColors.onSecondary,
TUIDefaultColors.secondaryAlt,
TUIDefaultColors.onSecondaryAlt,
TUIDefaultColors.secondaryHover,
TUIDefaultColors.secondaryAltHover,
TUIDefaultColors.tertiary,
TUIDefaultColors.onTertiary,
TUIDefaultColors.tertiaryAlt,
TUIDefaultColors.onTertiaryAlt,
TUIDefaultColors.tertiaryHover,
TUIDefaultColors.tertiaryAltHover,
TUIDefaultColors.success,
TUIDefaultColors.onSuccess,
TUIDefaultColors.success10,
TUIDefaultColors.success20,
TUIDefaultColors.error,
TUIDefaultColors.onError,
TUIDefaultColors.error10,
TUIDefaultColors.errorHover,
TUIDefaultColors.warning,
TUIDefaultColors.onWarning,
TUIDefaultColors.warning10,
TUIDefaultColors.warningHover,
TUIDefaultColors.background,
TUIDefaultColors.onBackground,
TUIDefaultColors.outline,
TUIDefaultColors.disabledContent,
TUIDefaultColors.disabledBackground,
TUIDefaultColors.disabledBackgroundHover,
TUIDefaultColors.link,
TUIDefaultColors.inputText,
TUIDefaultColors.inputBackground,
TUIDefaultColors.inputTextDim,
TUIDefaultColors.surface,
TUIDefaultColors.surface50,
TUIDefaultColors.onSurface,
TUIDefaultColors.surfaceVariant,
TUIDefaultColors.surfaceHover,
TUIDefaultColors.surfaceVariantHover,
TUIDefaultColors.constantLight,
TUIDefaultColors.constantDark),
TUITypography(
TUITextStyle.heading1,
TUITextStyle.heading2,
Expand Down
5 changes: 1 addition & 4 deletions test/tarka_ui_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@

void main() {

}
void main() {}
4 changes: 2 additions & 2 deletions test/utils.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
extension StringExtension on String {
String capitalize() {
if(isEmpty) {
if (isEmpty) {
return this;
}
return "${this[0].toUpperCase()}${substring(1)}";
}
}
}
3 changes: 2 additions & 1 deletion test/widget_test/app_bar_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ main() {
await widgetTester.pumpWidgetBuilder(appBar, wrapper: tuiAppWrapper());
//Since we know that, `BottomNavigationBar` will always be displayed on top of SystemNavBar, we can be assured that TUIAppBar will also be displayed above System Nav Bar.
var bottomNavBarFinder = find.descendant(
of: find.byType(TUIAppTopBar), matching: find.byType(BottomNavigationBar));
of: find.byType(TUIAppTopBar),
matching: find.byType(BottomNavigationBar));
expect(bottomNavBarFinder, findsOneWidget);
});

Expand Down
14 changes: 7 additions & 7 deletions test/widget_test/icon_button_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ void main() {
bool isLongPressed = false;
await widgetTester.pumpWidget(wrapApp(
child: TUIIconButton(
type: TUIIconButtonType.primary,
size: TUIIconButtonSize.px48,
key: const Key("IconButton"),
iconData: FluentIcons.flag_24_filled,
onPressed: () => {},
onLongPress: () => {isLongPressed = true},
)));
type: TUIIconButtonType.primary,
size: TUIIconButtonSize.px48,
key: const Key("IconButton"),
iconData: FluentIcons.flag_24_filled,
onPressed: () => {},
onLongPress: () => {isLongPressed = true},
)));
await widgetTester.longPress(find.byKey(const Key("IconButton")));
expect(isLongPressed, true,
reason: "Icon Button long press did not trigger onLongPress callback");
Expand Down

0 comments on commit f9732f0

Please sign in to comment.