Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
HOTIFX Fix adaptive widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
Boehrsi committed Oct 25, 2019
1 parent 0956d17 commit a9d2b55
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 20 deletions.
6 changes: 3 additions & 3 deletions lib/src/adaptiveWidgets/adaptive_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class AdaptiveAppBar extends AdaptiveWidget<CupertinoTheme, AppBar> with Preferr
this.actions,
this.elevation,
this.leadingIcon,
}) : super(key: key);
}) : super(childKey: key);

@override
AppBar buildMaterialWidget(BuildContext context) {
return AppBar(
key: key,
key: childKey,
leading: leadingIcon,
title: title,
actions: actions,
Expand All @@ -41,7 +41,7 @@ class AdaptiveAppBar extends AdaptiveWidget<CupertinoTheme, AppBar> with Preferr
barBackgroundColor: primary,
),
child: CupertinoNavigationBar(
key: key,
key: childKey,
leading: leadingIcon,
padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
middle: Padding(
Expand Down
6 changes: 3 additions & 3 deletions lib/src/adaptiveWidgets/adaptive_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class AdaptiveDialog extends AdaptiveWidget<CupertinoAlertDialog, AlertDialog> {
this.title,
this.content,
this.actions,
}) : super(key: key);
}) : super(childKey: key);

@override
AlertDialog buildMaterialWidget(BuildContext context) {
return AlertDialog(
key: key,
key: childKey,
title: title,
content: content,
actions: actions,
Expand All @@ -28,7 +28,7 @@ class AdaptiveDialog extends AdaptiveWidget<CupertinoAlertDialog, AlertDialog> {
@override
CupertinoAlertDialog buildCupertinoWidget(BuildContext context) {
return CupertinoAlertDialog(
key: key,
key: childKey,
title: title,
content: content,
actions: actions,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/adaptiveWidgets/adaptive_dialog_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class AdaptiveDialogAction extends AdaptiveWidget<CupertinoDialogAction, FlatBut
Key key,
this.child,
this.onPressed,
}) : super(key: key);
}) : super(childKey: key);

@override
FlatButton buildMaterialWidget(BuildContext context) {
return FlatButton(
key: key,
key: childKey,
child: child,
onPressed: onPressed,
);
Expand Down
6 changes: 3 additions & 3 deletions lib/src/adaptiveWidgets/adaptive_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ class AdaptiveIcon extends AdaptiveWidget<Icon, Icon> {
Key key,
this.androidIcon,
this.iosIcon,
}) : super(key: key);
}) : super(childKey: key);

@override
Icon buildMaterialWidget(BuildContext context) {
return Icon(
androidIcon,
key: key,
key: childKey,
);
}

@override
Icon buildCupertinoWidget(BuildContext context) {
return Icon(
iosIcon,
key: key,
key: childKey,
);
}
}
6 changes: 3 additions & 3 deletions lib/src/adaptiveWidgets/adaptive_icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class AdaptiveIconButton extends AdaptiveWidget<CupertinoButton, IconButton> {
this.icon,
this.onPressed,
this.color,
}) : super(key: key);
}) : super(childKey: key);

@override
IconButton buildMaterialWidget(BuildContext context) {
return IconButton(
key: key,
key: childKey,
icon: icon,
onPressed: onPressed,
);
Expand All @@ -28,7 +28,7 @@ class AdaptiveIconButton extends AdaptiveWidget<CupertinoButton, IconButton> {
@override
CupertinoButton buildCupertinoWidget(BuildContext context) {
return CupertinoButton(
key: key,
key: childKey,
padding: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),
child: icon,
onPressed: onPressed,
Expand Down
6 changes: 3 additions & 3 deletions lib/src/adaptiveWidgets/adaptive_ink_well.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ class AdaptiveInkWell extends AdaptiveWidget<GestureDetector, InkWell> {
Key key,
this.onTap,
this.child,
}) : super(key: key);
}) : super(childKey: key);

@override
InkWell buildMaterialWidget(BuildContext context) {
return InkWell(
key: key,
key: childKey,
onTap: onTap,
child: child,
);
Expand All @@ -25,7 +25,7 @@ class AdaptiveInkWell extends AdaptiveWidget<GestureDetector, InkWell> {
@override
GestureDetector buildCupertinoWidget(BuildContext context) {
return GestureDetector(
key: key,
key: childKey,
onTap: onTap,
child: child,
);
Expand Down
4 changes: 3 additions & 1 deletion lib/src/adaptiveWidgets/adaptive_raised_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ class AdaptiveRaisedButton extends AdaptiveWidget<CupertinoButton, ButtonTheme>
this.textColor,
this.shape,
this.child,
}) : super(key: key);
}) : super(childKey: key);

@override
ButtonTheme buildMaterialWidget(BuildContext context) {
return ButtonTheme(
minWidth: buttonWidth ?? buttonThemeMinWidth,
child: RaisedButton(
key: childKey,
color: color,
textColor: textColor,
child: child,
Expand All @@ -39,6 +40,7 @@ class AdaptiveRaisedButton extends AdaptiveWidget<CupertinoButton, ButtonTheme>
@override
CupertinoButton buildCupertinoWidget(BuildContext context) {
return CupertinoButton(
key: childKey,
padding: EdgeInsets.symmetric(vertical: 14.0, horizontal: 24.0),
color: color,
child: child,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/adaptiveWidgets/adaptive_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

abstract class AdaptiveWidget<C extends Widget, M extends Widget> extends StatelessWidget {
final Key key;
final Key childKey;

AdaptiveWidget({this.key});
AdaptiveWidget({@required this.childKey});

C buildCupertinoWidget(BuildContext context);

Expand Down

0 comments on commit a9d2b55

Please sign in to comment.