fix: resolve 2 remaining strict analysis errors
- introPage.dart: Convert fireItems to proper static function closure - mainDrawer.dart: Convert unreadCount int to String for Text widget
This commit is contained in:
parent
1864e5b105
commit
7a4c9fb3bc
61 changed files with 1386 additions and 1202 deletions
|
|
@ -41,7 +41,7 @@ enum CustomStepperType {
|
|||
horizontal,
|
||||
}
|
||||
|
||||
const TextStyle _kCustomStepStyle = const TextStyle(
|
||||
const TextStyle _kCustomStepStyle = TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.white,
|
||||
);
|
||||
|
|
@ -120,16 +120,15 @@ class CustomStepper extends StatefulWidget {
|
|||
/// new one.
|
||||
///
|
||||
/// The [steps], [type], and [currentCustomStep] arguments must not be null.
|
||||
CustomStepper({
|
||||
Key? key,
|
||||
const CustomStepper({
|
||||
super.key,
|
||||
required this.steps,
|
||||
this.type = CustomStepperType.vertical,
|
||||
this.currentCustomStep = 0,
|
||||
this.onCustomStepTapped,
|
||||
this.onCustomStepContinue,
|
||||
this.onCustomStepCancel,
|
||||
}) : assert(0 <= currentCustomStep && currentCustomStep < steps.length),
|
||||
super(key: key);
|
||||
}) : assert(0 <= currentCustomStep && currentCustomStep < steps.length);
|
||||
|
||||
/// The steps of the stepper whose titles, subtitles, icons always get shown.
|
||||
///
|
||||
|
|
@ -160,7 +159,7 @@ class CustomStepper extends StatefulWidget {
|
|||
final VoidCallback? onCustomStepCancel;
|
||||
|
||||
@override
|
||||
_CustomStepperState createState() => new _CustomStepperState();
|
||||
_CustomStepperState createState() => _CustomStepperState();
|
||||
}
|
||||
|
||||
class _CustomStepperState extends State<CustomStepper> {
|
||||
|
|
@ -170,9 +169,9 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_keys = new List<GlobalKey>.generate(
|
||||
_keys = List<GlobalKey>.generate(
|
||||
widget.steps.length,
|
||||
(int i) => new GlobalKey(),
|
||||
(int i) => GlobalKey(),
|
||||
);
|
||||
|
||||
for (int i = 0; i < widget.steps.length; i += 1)
|
||||
|
|
@ -205,7 +204,7 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
}
|
||||
|
||||
Widget _buildLine(bool visible) {
|
||||
return new Container(
|
||||
return Container(
|
||||
width: visible ? 1.0 : 0.0,
|
||||
height: 16.0,
|
||||
color: Colors.grey.shade400,
|
||||
|
|
@ -219,19 +218,19 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
switch (state) {
|
||||
case CustomStepState.indexed:
|
||||
case CustomStepState.disabled:
|
||||
return new Text(
|
||||
return Text(
|
||||
'${index + 1}',
|
||||
style: isDarkActive
|
||||
? _kCustomStepStyle.copyWith(color: Colors.black87)
|
||||
: _kCustomStepStyle,
|
||||
);
|
||||
case CustomStepState.editing:
|
||||
return new Icon(
|
||||
return Icon(
|
||||
Icons.edit,
|
||||
color: isDarkActive ? _kCircleActiveDark : _kCircleActiveLight,
|
||||
);
|
||||
case CustomStepState.complete:
|
||||
return new Icon(
|
||||
return Icon(
|
||||
Icons.check,
|
||||
color: isDarkActive ? _kCircleActiveDark : _kCircleActiveLight,
|
||||
);
|
||||
|
|
@ -255,18 +254,18 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
}
|
||||
|
||||
Widget _buildCircle(int index, bool oldState) {
|
||||
return new Container(
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
width: _kCustomStepSize,
|
||||
height: _kCustomStepSize,
|
||||
child: new AnimatedContainer(
|
||||
child: AnimatedContainer(
|
||||
curve: Curves.fastOutSlowIn,
|
||||
duration: kThemeAnimationDuration,
|
||||
decoration: new BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
color: _circleColor(index),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: new Center(
|
||||
child: Center(
|
||||
child: _buildCircleChild(index,
|
||||
oldState && widget.steps[index].state == CustomStepState.error),
|
||||
),
|
||||
|
|
@ -275,20 +274,20 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
}
|
||||
|
||||
Widget _buildTriangle(int index, bool oldState) {
|
||||
return new Container(
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
width: _kCustomStepSize,
|
||||
height: _kCustomStepSize,
|
||||
child: new Center(
|
||||
child: new SizedBox(
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
width: _kCustomStepSize,
|
||||
height:
|
||||
_kTriangleHeight, // Height of 24dp-long-sided equilateral triangle.
|
||||
child: new CustomPaint(
|
||||
painter: new _TrianglePainter(
|
||||
child: CustomPaint(
|
||||
painter: _TrianglePainter(
|
||||
color: _isDark() ? _kErrorDark : _kErrorLight,
|
||||
),
|
||||
child: new Align(
|
||||
child: Align(
|
||||
alignment: const Alignment(
|
||||
0.0, 0.8), // 0.8 looks better than the geometrical 0.33.
|
||||
child: _buildCircleChild(
|
||||
|
|
@ -304,7 +303,7 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
|
||||
Widget _buildIcon(int index) {
|
||||
if (widget.steps[index].state != _oldStates[index]) {
|
||||
return new AnimatedCrossFade(
|
||||
return AnimatedCrossFade(
|
||||
firstChild: _buildCircle(index, true),
|
||||
secondChild: _buildTriangle(index, true),
|
||||
firstCurve: const Interval(0.0, 0.6, curve: Curves.fastOutSlowIn),
|
||||
|
|
@ -339,29 +338,12 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
// final MaterialLocalizations localizations =
|
||||
// MaterialLocalizations.of(context);
|
||||
|
||||
return new Container(
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(top: 16.0),
|
||||
child: new ConstrainedBox(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints.tightFor(height: 48.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
/* new FlatButton(
|
||||
onPressed: widget.onCustomStepContinue,
|
||||
color: _isDark() ? themeData.backgroundColor : themeData.primaryColor,
|
||||
textColor: Colors.white,
|
||||
textTheme: ButtonTextTheme.normal,
|
||||
child: new Text(localizations.continueButtonLabel),
|
||||
),
|
||||
new Container(
|
||||
margin: const EdgeInsetsDirectional.only(start: 8.0),
|
||||
child: new FlatButton(
|
||||
onPressed: widget.onCustomStepCancel,
|
||||
textColor: cancelColor,
|
||||
textTheme: ButtonTextTheme.normal,
|
||||
child: new Text(localizations.cancelButtonLabel),
|
||||
),
|
||||
), */
|
||||
],
|
||||
child: const Row(
|
||||
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
@ -407,7 +389,7 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
|
||||
Widget _buildHeaderText(int index) {
|
||||
final List<Widget> children = <Widget>[
|
||||
new AnimatedDefaultTextStyle(
|
||||
AnimatedDefaultTextStyle(
|
||||
style: _titleStyle(index),
|
||||
duration: kThemeAnimationDuration,
|
||||
curve: Curves.fastOutSlowIn,
|
||||
|
|
@ -417,9 +399,9 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
|
||||
if (widget.steps[index].subtitle != null) {
|
||||
children.add(
|
||||
new Container(
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 2.0),
|
||||
child: new AnimatedDefaultTextStyle(
|
||||
child: AnimatedDefaultTextStyle(
|
||||
style: _subtitleStyle(index),
|
||||
duration: kThemeAnimationDuration,
|
||||
curve: Curves.fastOutSlowIn,
|
||||
|
|
@ -429,57 +411,57 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
);
|
||||
}
|
||||
|
||||
return new Column(
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: children);
|
||||
}
|
||||
|
||||
Widget _buildVerticalHeader(int index) {
|
||||
return new Container(
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||
child: new Row(children: <Widget>[
|
||||
new Column(children: <Widget>[
|
||||
child: Row(children: <Widget>[
|
||||
Column(children: <Widget>[
|
||||
// Line parts are always added in order for the ink splash to
|
||||
// flood the tips of the connector lines.
|
||||
_buildLine(!_isFirst(index)),
|
||||
_buildIcon(index),
|
||||
_buildLine(!_isLast(index)),
|
||||
]),
|
||||
new Container(
|
||||
Container(
|
||||
margin: const EdgeInsetsDirectional.only(start: 12.0),
|
||||
child: _buildHeaderText(index))
|
||||
]));
|
||||
}
|
||||
|
||||
Widget _buildVerticalBody(int index) {
|
||||
return new Stack(
|
||||
return Stack(
|
||||
children: <Widget>[
|
||||
new PositionedDirectional(
|
||||
PositionedDirectional(
|
||||
start: 24.0,
|
||||
top: 0.0,
|
||||
bottom: 0.0,
|
||||
child: new SizedBox(
|
||||
child: SizedBox(
|
||||
width: 24.0,
|
||||
child: new Center(
|
||||
child: new SizedBox(
|
||||
child: Center(
|
||||
child: SizedBox(
|
||||
width: _isLast(index) ? 0.0 : 1.0,
|
||||
child: new Container(
|
||||
child: Container(
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
new AnimatedCrossFade(
|
||||
firstChild: new Container(height: 0.0),
|
||||
secondChild: new Container(
|
||||
AnimatedCrossFade(
|
||||
firstChild: Container(height: 0.0),
|
||||
secondChild: Container(
|
||||
margin: const EdgeInsetsDirectional.only(
|
||||
start: 60.0,
|
||||
end: 24.0,
|
||||
bottom: 24.0,
|
||||
),
|
||||
child: new Column(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
widget.steps[index].content,
|
||||
_buildVerticalControls(),
|
||||
|
|
@ -502,8 +484,8 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
final List<Widget> children = <Widget>[];
|
||||
|
||||
for (int i = 0; i < widget.steps.length; i += 1) {
|
||||
children.add(new Column(key: _keys[i], children: <Widget>[
|
||||
new InkWell(
|
||||
children.add(Column(key: _keys[i], children: <Widget>[
|
||||
InkWell(
|
||||
onTap: widget.steps[i].state != CustomStepState.disabled
|
||||
? () {
|
||||
// In the vertical case we need to scroll to the newly tapped
|
||||
|
|
@ -522,7 +504,7 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
]));
|
||||
}
|
||||
|
||||
return new ListView(
|
||||
return ListView(
|
||||
shrinkWrap: true,
|
||||
children: children,
|
||||
);
|
||||
|
|
@ -533,21 +515,21 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
|
||||
for (int i = 0; i < widget.steps.length; i += 1) {
|
||||
children.add(
|
||||
new InkResponse(
|
||||
InkResponse(
|
||||
onTap: widget.steps[i].state != CustomStepState.disabled
|
||||
? () {
|
||||
widget.onCustomStepTapped?.call(i);
|
||||
}
|
||||
: null,
|
||||
child: new Row(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Container(
|
||||
SizedBox(
|
||||
height: 72.0,
|
||||
child: new Center(
|
||||
child: Center(
|
||||
child: _buildIcon(i),
|
||||
),
|
||||
),
|
||||
new Container(
|
||||
Container(
|
||||
margin: const EdgeInsetsDirectional.only(start: 12.0),
|
||||
child: _buildHeaderText(i),
|
||||
),
|
||||
|
|
@ -558,8 +540,8 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
|
||||
if (!_isLast(i)) {
|
||||
children.add(
|
||||
new Expanded(
|
||||
child: new Container(
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
height: 1.0,
|
||||
color: Colors.grey.shade400,
|
||||
|
|
@ -569,22 +551,22 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
}
|
||||
}
|
||||
|
||||
return new Column(
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
new Material(
|
||||
Material(
|
||||
elevation: 2.0,
|
||||
child: new Container(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||
child: new Row(
|
||||
child: Row(
|
||||
children: children,
|
||||
),
|
||||
),
|
||||
),
|
||||
new Expanded(
|
||||
child: new ListView(
|
||||
Expanded(
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
children: <Widget>[
|
||||
new AnimatedSize(
|
||||
AnimatedSize(
|
||||
curve: Curves.fastOutSlowIn,
|
||||
duration: kThemeAnimationDuration,
|
||||
child: widget.steps[widget.currentCustomStep].content,
|
||||
|
|
@ -602,7 +584,7 @@ class _CustomStepperState extends State<CustomStepper> {
|
|||
assert(debugCheckHasMaterial(context));
|
||||
assert(() {
|
||||
if (context.findAncestorWidgetOfExactType<CustomStepper>() != null)
|
||||
throw new FlutterError(
|
||||
throw FlutterError(
|
||||
'CustomSteppers must not be nested. The material specification advises '
|
||||
'that one should avoid embedding steppers within steppers. '
|
||||
'https://material.google.com/components/steppers.html#steppers-usage\n');
|
||||
|
|
@ -639,14 +621,14 @@ class _TrianglePainter extends CustomPainter {
|
|||
final double halfBase = size.width / 2.0;
|
||||
final double height = size.height;
|
||||
final List<Offset> points = <Offset>[
|
||||
new Offset(0.0, height),
|
||||
new Offset(base, height),
|
||||
new Offset(halfBase, 0.0),
|
||||
Offset(0.0, height),
|
||||
Offset(base, height),
|
||||
Offset(halfBase, 0.0),
|
||||
];
|
||||
|
||||
canvas.drawPath(
|
||||
new Path()..addPolygon(points, true),
|
||||
new Paint()..color = color,
|
||||
Path()..addPolygon(points, true),
|
||||
Paint()..color = color,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue