| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- import 'package:flutter/material.dart';
- import 'dart:math' as math;
- class FShape {
- final FBorderShape borderShape;
- final BorderRadiusGeometry borderRadius;
- final BorderSide side;
- const FShape({
- this.borderShape: FBorderShape.RoundedRectangle,
- this.borderRadius: const BorderRadius.all(Radius.circular(10)),
- this.side: const BorderSide(
- color: Colors.transparent, style: BorderStyle.solid, width: 0),
- });
- }
- class FShadow {
- final Color highlightColor;
- final double highlightDistance;
- final double highlightBlur;
- final double highlightSpread;
- final Color shadowColor;
- final double shadowDistance;
- final double shadowBlur;
- final double shadowSpread;
- final Offset shadowOffset;
- const FShadow({
- this.highlightColor = FHighlightShadowColor,
- this.highlightDistance = 3,
- this.highlightBlur = 6,
- this.highlightSpread = 1,
- this.shadowColor = FDarkShadowColor,
- this.shadowDistance = 3,
- this.shadowBlur = 6,
- this.shadowSpread = 1,
- this.shadowOffset,
- });
- }
- /// 为组件设置边角。
- ///
- /// Set corners for widget
- class FCorner {
- final double leftTopCorner;
- final double rightTopCorner;
- final double rightBottomCorner;
- final double leftBottomCorner;
- const FCorner({
- this.leftTopCorner = 0,
- this.rightTopCorner = 0,
- this.rightBottomCorner = 0,
- this.leftBottomCorner = 0,
- });
- FCorner.all(double radius)
- : leftTopCorner = radius,
- rightTopCorner = radius,
- rightBottomCorner = radius,
- leftBottomCorner = radius;
- }
- /// 边角风格。
- /// [round] - 圆角
- /// [bevel] - 斜角
- ///
- /// Rounded corner style.
- /// [round]-rounded corners
- /// [bevel]-beveled corners
- enum FCornerStyle {
- round,
- bevel,
- }
- typedef FGroupContorllerClickCallback = List<Color> Function(
- Widget stateChanged, bool selected, List<Widget> widgets);
- class FGroupController {
- final List<State> states = List();
- final FGroupContorllerClickCallback groupClickCallback;
- final bool mustBeSelected;
- FGroupController({this.mustBeSelected = false, this.groupClickCallback});
- }
- enum FGradientType {
- Linear,
- Radial,
- Sweep,
- }
- enum FLightOrientation {
- LeftTop,
- LeftBottom,
- RightTop,
- RightBottom,
- }
- enum FBorderShape {
- RoundedRectangle,
- ContinuousRectangle,
- BeveledRectangle,
- }
- enum FSurface {
- Flat, //平面
- Convex, //凸面
- Concave, //凹面
- }
- enum FState {
- Normal,
- Highlighted,
- Disable,
- }
- enum FAppearance {
- Flat,
- Neumorphism,
- Material,
- }
- enum FType {
- Button,
- Toggle,
- }
- typedef FColorForStateCallback = Color Function(
- Widget sender, FState state);
- typedef FGradientForStateCallback = Gradient Function(
- Widget sender, FState state);
- typedef FBorderForStateCallback = Border Function(
- Widget sender, FState state);
- typedef FChildForStateCallback = Widget Function(
- Widget sender, FState state);
- typedef FTapEventForStateCallback = void Function(
- Widget sender, FState state, bool checked);
- typedef FShapeForStateCallback = FShape Function(
- Widget sender, FState state);
- typedef FSurfaceForStateCallback = FSurface Function(
- Widget sender, FState state);
- typedef FOnTapCallback = void Function(Widget sender, bool checked);
- typedef FOnTapDownCallback = void Function(Widget sender, bool checked);
- typedef FOnTapCancelCallback = void Function(Widget sender, bool checked);
- typedef FOnTapUpCallback = void Function(Widget sender, bool checked);
- //ZenUI库中所有组件的主颜色
- const Color FPrimerColor = Colors.lightBlueAccent;
- const Color FInnerShadowColor = Colors.black38;
- const Offset FInnerShadowOffset = Offset(10, 10);
- const Color FHighlightShadowColor = Colors.white;
- const Color FDarkShadowColor = Colors.black;
- const Color FDisableColor = Colors.grey;
|