Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,25 @@ jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- run: dart format --set-exit-if-changed lib test
- run: |
flutter pub get
dart format --set-exit-if-changed .

analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- run: flutter analyze lib test
# END LINTING STAGE

# BEGIN TESTING STAGE
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- run: flutter test
# END TESTING STAGE

8 changes: 6 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include: package:very_good_analysis/analysis_options.2.4.0.yaml
include: package:very_good_analysis/analysis_options.7.0.0.yaml

analyzer:
errors:
document_ignores: ignore

linter:
rules:
Expand All @@ -8,4 +12,4 @@ linter:
only_throw_errors: false
avoid_returning_this: false
prefer_function_declarations_over_variables: false
no_logic_in_create_state: false
no_logic_in_create_state: false
15 changes: 15 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include: package:very_good_analysis/analysis_options.7.0.0.yaml

analyzer:
errors:
document_ignores: ignore

linter:
rules:
public_member_api_docs: false
sort_constructors_first: false
avoid_positional_boolean_parameters: false
only_throw_errors: false
avoid_returning_this: false
prefer_function_declarations_over_variables: false
no_logic_in_create_state: false
4 changes: 2 additions & 2 deletions example/lib/widgets/message_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class MessageCard extends StatelessWidget {
final Color infoColor;

const MessageCard({
Key? key,
required this.message,
required this.type,
super.key,
this.errorColor = const Color(0xFFCC6941),
this.infoColor = const Color(0xFF5E89FF),
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ version: 1.0.0+1
publish_to: none

environment:
sdk: ">=3.0.0 <4.0.0"
flutter: ">=3.13.0"
sdk: ">=3.6.0 <4.0.0"
flutter: ">=3.27.0"

dependencies:
dashbook:
Expand All @@ -19,7 +19,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
very_good_analysis: ^5.1.0
very_good_analysis: ^7.0.0

flutter:
uses-material-design: true
36 changes: 13 additions & 23 deletions lib/src/story.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,12 @@ class ListProperty<T> extends Property<T> {
final List<T> list;

ListProperty(
String name,
T defaultValue,
super.name,
super.defaultValue,
this.list, {
String? tooltipMessage,
ControlProperty? visibilityControlProperty,
}) : super(
name,
defaultValue,
tooltipMessage: tooltipMessage,
visibilityControlProperty: visibilityControlProperty,
);
super.tooltipMessage,
super.visibilityControlProperty,
});

@override
Widget createPropertyEditor({required PropertyChanged onChanged, Key? key}) {
Expand All @@ -119,17 +114,12 @@ class OptionsProperty<T> extends Property<T> {
final List<PropertyOption<T>> list;

OptionsProperty(
String name,
T defaultValue,
super.name,
super.defaultValue,
this.list, {
String? tooltipMessage,
ControlProperty? visibilityControlProperty,
}) : super(
name,
defaultValue,
tooltipMessage: tooltipMessage,
visibilityControlProperty: visibilityControlProperty,
);
super.tooltipMessage,
super.visibilityControlProperty,
});

@override
Widget createPropertyEditor({required PropertyChanged onChanged, Key? key}) {
Expand All @@ -154,7 +144,7 @@ class PropertyOption<T> {
}

class DashbookContext {
Map<String, Property> properties = {};
Map<String, Property<Object?>> properties = {};
Map<String, void Function(BuildContext)> actions = {};

void action(String name, void Function(BuildContext) callback) {
Expand Down Expand Up @@ -375,15 +365,15 @@ class Story {
String? info,
bool pinInfo = false,
}) {
final _chapter = Chapter(
final chapter = Chapter(
name,
buildFn,
this,
codeLink: codeLink,
info: info,
pinInfo: pinInfo,
);
chapters.add(_chapter);
chapters.add(chapter);

return this;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/actions_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import 'package:flutter/material.dart';

class ActionsContainer extends StatelessWidget {
const ActionsContainer({
Key? key,
required this.onCancel,
required this.currentChapter,
}) : super(key: key);
super.key,
});

final VoidCallback onCancel;
final Chapter currentChapter;
Expand Down
6 changes: 3 additions & 3 deletions lib/src/widgets/device_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ class DevicePreview extends StatelessWidget {
final bool showDeviceFrame;

const DevicePreview({
Key? key,
required this.child,
required this.deviceInfo,
required this.deviceOrientation,
required this.showDeviceFrame,
}) : super(key: key);
super.key,
});

@override
Widget build(BuildContext context) {
Expand All @@ -33,7 +33,7 @@ class DevicePreview extends StatelessWidget {
isFrameVisible: showDeviceFrame,
screen: MediaQuery(
data: mediaQuery,
child: Container(
child: ColoredBox(
color: Theme.of(context).scaffoldBackgroundColor,
child: child,
),
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/device_settings_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class DeviceSettingsContainer extends StatefulWidget {
final VoidCallback onCancel;

const DeviceSettingsContainer({
Key? key,
required this.onCancel,
}) : super(key: key);
super.key,
});

@override
State<DeviceSettingsContainer> createState() =>
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/intructions_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class InstructionsDialog extends StatelessWidget {
final String instructions;

const InstructionsDialog({
Key? key,
required this.instructions,
}) : super(key: key);
super.key,
});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class Link extends StatelessWidget {
final EdgeInsets padding;

const Link({
Key? key,
required this.label,
required this.textStyle,
required this.textAlign,
super.key,
this.onTap,
this.padding = const EdgeInsets.all(10),
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
12 changes: 6 additions & 6 deletions lib/src/widgets/properties_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class PropertiesContainer extends StatefulWidget {
final VoidCallback onCancel;

const PropertiesContainer({
Key? key,
required this.currentChapter,
required this.onPropertyChange,
required this.onCancel,
}) : super(key: key);
super.key,
});

@override
State createState() => _PropertiesContainerState();
Expand All @@ -41,17 +41,17 @@ class _PropertiesContainerState extends State<PropertiesContainer> {
}
}

final _propertyKey =
final propertyKey =
Key('${widget.currentChapter.id}#${entry.value.name}');
final _onChanged = () {
final onChanged = () {
setState(() {});
widget.onPropertyChange();
};

children.add(
entry.value.createPropertyEditor(
onChanged: _onChanged,
key: _propertyKey,
onChanged: onChanged,
key: propertyKey,
),
);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/property_widgets/bool_property.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class BoolProperty extends StatefulWidget {
const BoolProperty({
required this.property,
required this.onChanged,
Key? key,
}) : super(key: key);
super.key,
});

@override
State<StatefulWidget> createState() => BoolPropertyState(property.getValue());
Expand Down
5 changes: 3 additions & 2 deletions lib/src/widgets/property_widgets/border_radius_property.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class BorderRadiusProperty extends StatefulWidget {
const BorderRadiusProperty({
required this.property,
required this.onChanged,
Key? key,
}) : super(key: key);
super.key,
});

@override
State<StatefulWidget> createState() =>
Expand Down Expand Up @@ -60,6 +60,7 @@ class _BorderRadiusPropertyState extends State<BorderRadiusProperty> {
bottomRight: Radius.circular(bottomRight),
);
}
// ignore: avoid_catches_without_on_clauses
} catch (err) {
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/property_widgets/color_property.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class ColorProperty extends StatefulWidget {
const ColorProperty({
required this.property,
required this.onChanged,
Key? key,
}) : super(key: key);
super.key,
});

@override
State<StatefulWidget> createState() =>
Expand Down
5 changes: 3 additions & 2 deletions lib/src/widgets/property_widgets/edge_insets_property.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class EdgeInsetsProperty extends StatefulWidget {
const EdgeInsetsProperty({
required this.property,
required this.onChanged,
Key? key,
}) : super(key: key);
super.key,
});

@override
State<StatefulWidget> createState() =>
Expand Down Expand Up @@ -53,6 +53,7 @@ class _EdgeInsetsPropertyState extends State<EdgeInsetsProperty> {

return EdgeInsets.fromLTRB(left, top, right, bottom);
}
// ignore: avoid_catches_without_on_clauses
} catch (err) {
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/property_widgets/list_property.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class ListPropertyWidget<T> extends StatefulWidget {
const ListPropertyWidget({
required this.property,
required this.onChanged,
Key? key,
}) : super(key: key);
super.key,
});

@override
State<StatefulWidget> createState() => ListPropertyState<T>();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/property_widgets/number_property.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class NumberProperty extends StatefulWidget {
const NumberProperty({
required this.property,
required this.onChanged,
Key? key,
}) : super(key: key);
super.key,
});

@override
State<StatefulWidget> createState() =>
Expand Down
6 changes: 3 additions & 3 deletions lib/src/widgets/property_widgets/options_property.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ class OptionsPropertyWidget<T> extends StatefulWidget {
const OptionsPropertyWidget({
required this.property,
required this.onChanged,
Key? key,
}) : super(key: key);
super.key,
});

@override
State<StatefulWidget> createState() => OptionsPropertyState();
}

class OptionsPropertyState extends State<OptionsPropertyWidget> {
class OptionsPropertyState extends State<OptionsPropertyWidget<Object?>> {
@override
Widget build(BuildContext context) {
return PropertyScaffold(
Expand Down
Loading