-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [MDS-649] Create Table component (#262)
- Loading branch information
Showing
14 changed files
with
2,325 additions
and
5 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:moon_design/src/utils/color_premul_lerp.dart'; | ||
|
||
@immutable | ||
class MoonTableColors extends ThemeExtension<MoonTableColors> with DiagnosticableTreeMixin { | ||
/// Table column text color. | ||
final Color columnTextColor; | ||
|
||
/// Table row text color. | ||
final Color rowTextColor; | ||
|
||
/// Table row title text color. | ||
final Color rowTitleTextColor; | ||
|
||
/// Table row pinned and animated title text color. | ||
final Color rowPinnedAnimatedTitleTextColor; | ||
|
||
/// Table icon color. | ||
final Color iconColor; | ||
|
||
/// Table row background color. | ||
final Color rowBackgroundColor; | ||
|
||
const MoonTableColors({ | ||
required this.columnTextColor, | ||
required this.rowTextColor, | ||
required this.rowTitleTextColor, | ||
required this.rowPinnedAnimatedTitleTextColor, | ||
required this.iconColor, | ||
required this.rowBackgroundColor, | ||
}); | ||
|
||
@override | ||
MoonTableColors copyWith({ | ||
Color? columnTextColor, | ||
Color? rowTextColor, | ||
Color? rowTitleTextColor, | ||
Color? rowPinnedAnimatedTitleTextColor, | ||
Color? iconColor, | ||
Color? rowBackgroundColor, | ||
}) { | ||
return MoonTableColors( | ||
columnTextColor: columnTextColor ?? this.columnTextColor, | ||
rowTextColor: rowTextColor ?? this.rowTextColor, | ||
rowTitleTextColor: rowTitleTextColor ?? this.rowTitleTextColor, | ||
rowPinnedAnimatedTitleTextColor: rowPinnedAnimatedTitleTextColor ?? this.rowPinnedAnimatedTitleTextColor, | ||
iconColor: iconColor ?? this.iconColor, | ||
rowBackgroundColor: rowBackgroundColor ?? this.rowBackgroundColor, | ||
); | ||
} | ||
|
||
@override | ||
MoonTableColors lerp(ThemeExtension<MoonTableColors>? other, double t) { | ||
if (other is! MoonTableColors) return this; | ||
|
||
return MoonTableColors( | ||
columnTextColor: colorPremulLerp(columnTextColor, other.columnTextColor, t)!, | ||
rowTextColor: colorPremulLerp(rowTextColor, other.rowTextColor, t)!, | ||
rowTitleTextColor: | ||
colorPremulLerp(rowTitleTextColor, other.rowTitleTextColor, t)!, | ||
rowPinnedAnimatedTitleTextColor: | ||
colorPremulLerp(rowPinnedAnimatedTitleTextColor, other.rowPinnedAnimatedTitleTextColor, t)!, | ||
iconColor: colorPremulLerp(iconColor, other.iconColor, t)!, | ||
rowBackgroundColor: colorPremulLerp(rowBackgroundColor, other.rowBackgroundColor, t)!, | ||
); | ||
} | ||
|
||
@override | ||
void debugFillProperties(DiagnosticPropertiesBuilder properties) { | ||
super.debugFillProperties(properties); | ||
properties | ||
..add(DiagnosticsProperty("type", "MoonTableColors")) | ||
..add(ColorProperty("columnTextColor", columnTextColor)) | ||
..add(ColorProperty("rowTextColor", rowTextColor)) | ||
..add(ColorProperty("rowTitleTextColor", rowTitleTextColor)) | ||
..add(ColorProperty("rowPinnedAnimatedTitleTextColor", rowPinnedAnimatedTitleTextColor)) | ||
..add(ColorProperty("iconColor", iconColor)) | ||
..add(ColorProperty("rowBackgroundColor", rowBackgroundColor)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
@immutable | ||
class MoonTableProperties extends ThemeExtension<MoonTableProperties> with DiagnosticableTreeMixin { | ||
/// Table row animated title transition duration. | ||
final Duration transitionDuration; | ||
|
||
/// Table row animated title transition curve. | ||
final Curve transitionCurve; | ||
|
||
const MoonTableProperties({ | ||
required this.transitionDuration, | ||
required this.transitionCurve, | ||
}); | ||
|
||
@override | ||
MoonTableProperties copyWith({ | ||
Duration? transitionDuration, | ||
Curve? transitionCurve, | ||
}) { | ||
return MoonTableProperties( | ||
transitionDuration: transitionDuration ?? this.transitionDuration, | ||
transitionCurve: transitionCurve ?? this.transitionCurve, | ||
); | ||
} | ||
|
||
@override | ||
MoonTableProperties lerp(ThemeExtension<MoonTableProperties>? other, double t) { | ||
if (other is! MoonTableProperties) return this; | ||
|
||
return MoonTableProperties( | ||
transitionDuration: lerpDuration(transitionDuration, other.transitionDuration, t), | ||
transitionCurve: other.transitionCurve, | ||
); | ||
} | ||
|
||
@override | ||
void debugFillProperties(DiagnosticPropertiesBuilder properties) { | ||
super.debugFillProperties(properties); | ||
properties | ||
..add(DiagnosticsProperty("type", "MoonTableProperties")) | ||
..add(DiagnosticsProperty<Duration>("transitionDuration", transitionDuration)) | ||
..add(DiagnosticsProperty<Curve>("transitionCurve", transitionCurve)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import 'dart:ui'; | ||
|
||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
@immutable | ||
class MoonTableSizeProperties extends ThemeExtension<MoonTableSizeProperties> with DiagnosticableTreeMixin { | ||
/// Table row border radius. | ||
final BorderRadiusGeometry rowBorderRadius; | ||
|
||
/// Space between table rows. | ||
final double rowGap; | ||
|
||
/// Table row height. | ||
final double rowHeight; | ||
|
||
/// Horizontal gap between column label and sort icon. | ||
final double sortIconGap; | ||
|
||
/// Table sort icon size value. | ||
final double sortIconSizeValue; | ||
|
||
/// Table row cell padding. | ||
final EdgeInsetsGeometry cellPadding; | ||
|
||
/// Table row cell padding. | ||
final EdgeInsetsGeometry rowTitlePadding; | ||
|
||
/// Table column text style. | ||
final TextStyle columnTextStyle; | ||
|
||
/// Table row text style. | ||
final TextStyle rowTextStyle; | ||
|
||
/// Table row title text style. | ||
final TextStyle rowTitleTextStyle; | ||
|
||
/// Table row animated title text style. | ||
final TextStyle rowPinnedAnimatedTitleTextStyle; | ||
|
||
const MoonTableSizeProperties({ | ||
required this.rowBorderRadius, | ||
required this.rowGap, | ||
required this.rowHeight, | ||
required this.sortIconGap, | ||
required this.sortIconSizeValue, | ||
required this.cellPadding, | ||
required this.rowTitlePadding, | ||
required this.columnTextStyle, | ||
required this.rowTextStyle, | ||
required this.rowTitleTextStyle, | ||
required this.rowPinnedAnimatedTitleTextStyle, | ||
}); | ||
|
||
@override | ||
MoonTableSizeProperties copyWith({ | ||
BorderRadiusGeometry? rowBorderRadius, | ||
double? rowGap, | ||
double? rowHeight, | ||
double? sortIconGap, | ||
double? sortIconSizeValue, | ||
EdgeInsetsGeometry? cellPadding, | ||
EdgeInsetsGeometry? rowTitlePadding, | ||
TextStyle? columnTextStyle, | ||
TextStyle? rowTextStyle, | ||
TextStyle? rowTitleTextStyle, | ||
TextStyle? rowPinnedAnimatedTitleTextStyle, | ||
}) { | ||
return MoonTableSizeProperties( | ||
rowBorderRadius: rowBorderRadius ?? this.rowBorderRadius, | ||
rowGap: rowGap ?? this.rowGap, | ||
rowHeight: rowHeight ?? this.rowHeight, | ||
sortIconGap: sortIconGap ?? this.sortIconGap, | ||
sortIconSizeValue: sortIconSizeValue ?? this.sortIconSizeValue, | ||
cellPadding: cellPadding ?? this.cellPadding, | ||
rowTitlePadding: rowTitlePadding ?? this.rowTitlePadding, | ||
columnTextStyle: columnTextStyle ?? this.columnTextStyle, | ||
rowTextStyle: rowTextStyle ?? this.rowTextStyle, | ||
rowTitleTextStyle: rowTitleTextStyle ?? this.rowTitleTextStyle, | ||
rowPinnedAnimatedTitleTextStyle: rowPinnedAnimatedTitleTextStyle ?? this.rowPinnedAnimatedTitleTextStyle, | ||
); | ||
} | ||
|
||
@override | ||
MoonTableSizeProperties lerp(ThemeExtension<MoonTableSizeProperties>? other, double t) { | ||
if (other is! MoonTableSizeProperties) return this; | ||
|
||
return MoonTableSizeProperties( | ||
rowBorderRadius: BorderRadiusGeometry.lerp(rowBorderRadius, other.rowBorderRadius, t)!, | ||
rowGap: lerpDouble(rowGap, other.rowGap, t)!, | ||
rowHeight: lerpDouble(rowHeight, other.rowHeight, t)!, | ||
sortIconGap: lerpDouble(sortIconGap, other.sortIconGap, t)!, | ||
sortIconSizeValue: lerpDouble(sortIconSizeValue, other.sortIconSizeValue, t)!, | ||
cellPadding: EdgeInsetsGeometry.lerp(cellPadding, other.cellPadding, t)!, | ||
rowTitlePadding: EdgeInsetsGeometry.lerp(rowTitlePadding, other.rowTitlePadding, t)!, | ||
columnTextStyle: TextStyle.lerp(columnTextStyle, other.columnTextStyle, t)!, | ||
rowTextStyle: TextStyle.lerp(rowTextStyle, other.rowTextStyle, t)!, | ||
rowTitleTextStyle: TextStyle.lerp(rowTitleTextStyle, other.rowTitleTextStyle, t)!, | ||
rowPinnedAnimatedTitleTextStyle: TextStyle.lerp(rowPinnedAnimatedTitleTextStyle, other.rowPinnedAnimatedTitleTextStyle, t)!, | ||
); | ||
} | ||
|
||
@override | ||
void debugFillProperties(DiagnosticPropertiesBuilder properties) { | ||
super.debugFillProperties(properties); | ||
properties | ||
..add(DiagnosticsProperty("type", "MoonTableSizeProperties")) | ||
..add(DiagnosticsProperty<BorderRadiusGeometry>("rowBorderRadius", rowBorderRadius)) | ||
..add(DoubleProperty("rowGap", rowGap)) | ||
..add(DoubleProperty("rowHeight", rowHeight)) | ||
..add(DoubleProperty("sortIconGap", sortIconGap)) | ||
..add(DoubleProperty("sortIconSizeValue", sortIconSizeValue)) | ||
..add(DiagnosticsProperty<EdgeInsetsGeometry>("cellPadding", cellPadding)) | ||
..add(DiagnosticsProperty<EdgeInsetsGeometry>("rowTitlePadding", rowTitlePadding)) | ||
..add(DiagnosticsProperty<TextStyle>("columnTextStyle", columnTextStyle)) | ||
..add(DiagnosticsProperty<TextStyle>("rowTextStyle", rowTextStyle)) | ||
..add(DiagnosticsProperty<TextStyle>("rowTitleTextStyle", rowTitleTextStyle)) | ||
..add(DiagnosticsProperty<TextStyle>("rowAnimatedTitleTextStyle", rowPinnedAnimatedTitleTextStyle)); | ||
} | ||
} |
Oops, something went wrong.