Skip to content

Commit

Permalink
Clean up analysis issues (Resolves #1165) (#1169)
Browse files Browse the repository at this point in the history
  • Loading branch information
rutvik110 authored Jun 13, 2023
1 parent f71edc5 commit 6c70c59
Show file tree
Hide file tree
Showing 64 changed files with 587 additions and 479 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
ios_text_example/
android_text_example/

.vscode
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:super_editor/super_editor.dart';
/// Each of the above steps are demonstrated in this example.
class TextWithHintDemo extends StatefulWidget {
@override
_TextWithHintDemoState createState() => _TextWithHintDemoState();
State<TextWithHintDemo> createState() => _TextWithHintDemoState();
}

class _TextWithHintDemoState extends State<TextWithHintDemo> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:super_editor/super_editor.dart';
/// The user can select around the horizontal rule, but cannot select it, specifically.
class UnselectableHrDemo extends StatefulWidget {
@override
_UnselectableHrDemoState createState() => _UnselectableHrDemoState();
State<UnselectableHrDemo> createState() => _UnselectableHrDemoState();
}

class _UnselectableHrDemoState extends State<UnselectableHrDemo> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:super_text_layout/super_text_layout.dart';
/// all the rest of Super Editor into the picture.
class SimpleDeltasInputDemo extends StatefulWidget {
@override
_SimpleDeltasInputState createState() => _SimpleDeltasInputState();
State<SimpleDeltasInputDemo> createState() => _SimpleDeltasInputState();
}

class _SimpleDeltasInputState extends State<SimpleDeltasInputDemo> with TextInputClient, DeltaTextInputClient {
Expand Down
7 changes: 4 additions & 3 deletions super_editor/example/lib/demos/demo_animated_task_height.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:super_editor/super_editor.dart';
/// Example of a task component whose height is animated.
class AnimatedTaskHeightDemo extends StatefulWidget {
@override
_AnimatedTaskHeightDemoState createState() => _AnimatedTaskHeightDemoState();
State<AnimatedTaskHeightDemo> createState() => _AnimatedTaskHeightDemoState();
}

class _AnimatedTaskHeightDemoState extends State<AnimatedTaskHeightDemo> {
Expand Down Expand Up @@ -99,6 +99,7 @@ class _AnimatedTaskComponent extends StatefulWidget {
const _AnimatedTaskComponent({
Key? key,
required this.viewModel,
// ignore: unused_element
this.showDebugPaint = false,
}) : super(key: key);

Expand Down Expand Up @@ -166,12 +167,12 @@ class _AnimatedTaskComponentState extends State<_AnimatedTaskComponent>
key: _animatedSizeKey,
duration: const Duration(milliseconds: 100),
child: widget.viewModel.selection != null
? SizedBox(
? const SizedBox(
height: 20,
child: Row(
children: [
Icon(Icons.label_important_outline, size: 16),
const SizedBox(width: 4),
SizedBox(width: 4),
Icon(Icons.timelapse_sharp, size: 16),
],
),
Expand Down
2 changes: 1 addition & 1 deletion super_editor/example/lib/demos/demo_app_shortcuts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:super_editor/super_editor.dart';

class AppShortcutsDemo extends StatefulWidget {
@override
_AppShortcutsDemoState createState() => _AppShortcutsDemoState();
State<AppShortcutsDemo> createState() => _AppShortcutsDemoState();
}

class _AppShortcutsDemoState extends State<AppShortcutsDemo> {
Expand Down
14 changes: 7 additions & 7 deletions super_editor/example/lib/demos/demo_attributed_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:super_text_layout/super_text_layout.dart';

class AttributedTextDemo extends StatefulWidget {
@override
_AttributedTextDemoState createState() => _AttributedTextDemoState();
State<AttributedTextDemo> createState() => _AttributedTextDemoState();
}

class _AttributedTextDemoState extends State<AttributedTextDemo> {
Expand All @@ -21,22 +21,22 @@ class _AttributedTextDemoState extends State<AttributedTextDemo> {
}

void _computeStyledText() {
AttributedText _text = AttributedText(
AttributedText text = AttributedText(
text: 'This is some text styled with AttributedText',
);

for (final range in _boldRanges) {
_text.addAttribution(boldAttribution, range);
text.addAttribution(boldAttribution, range);
}
for (final range in _italicsRanges) {
_text.addAttribution(italicsAttribution, range);
text.addAttribution(italicsAttribution, range);
}
for (final range in _strikethroughRanges) {
_text.addAttribution(strikethroughAttribution, range);
text.addAttribution(strikethroughAttribution, range);
}

setState(() {
_richText = _text.computeTextSpan((Set<Attribution> attributions) {
_richText = text.computeTextSpan((Set<Attribution> attributions) {
TextStyle newStyle = const TextStyle(
color: Colors.black,
fontSize: 30,
Expand Down Expand Up @@ -184,7 +184,7 @@ class TextRangeSelector extends StatefulWidget {
final void Function(List<SpanRange>)? onRangesChange;

@override
_TextRangeSelectorState createState() => _TextRangeSelectorState();
State<TextRangeSelector> createState() => _TextRangeSelectorState();
}

class _TextRangeSelectorState extends State<TextRangeSelector> {
Expand Down
4 changes: 2 additions & 2 deletions super_editor/example/lib/demos/demo_document_loses_focus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:super_editor/super_editor.dart';
/// its caret.
class LoseFocusDemo extends StatefulWidget {
@override
_LoseFocusDemoState createState() => _LoseFocusDemoState();
State<LoseFocusDemo> createState() => _LoseFocusDemoState();
}

class _LoseFocusDemoState extends State<LoseFocusDemo> {
Expand Down Expand Up @@ -35,7 +35,7 @@ class _LoseFocusDemoState extends State<LoseFocusDemo> {
_buildTextField(),
Expanded(
child: SuperEditorDebugVisuals(
config: SuperEditorDebugVisualsConfig(
config: const SuperEditorDebugVisualsConfig(
showFocus: true,
showImeConnection: true,
),
Expand Down
2 changes: 1 addition & 1 deletion super_editor/example/lib/demos/demo_empty_document.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:super_editor/super_editor.dart';
/// This demo can also be used to quickly hack experiments and tests.
class EmptyDocumentDemo extends StatefulWidget {
@override
_EmptyDocumentDemoState createState() => _EmptyDocumentDemoState();
State<EmptyDocumentDemo> createState() => _EmptyDocumentDemoState();
}

class _EmptyDocumentDemoState extends State<EmptyDocumentDemo> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:super_editor_markdown/super_editor_markdown.dart';
/// current structure of the document in the editor.
class MarkdownSerializationDemo extends StatefulWidget {
@override
_MarkdownSerializationDemoState createState() => _MarkdownSerializationDemoState();
State<MarkdownSerializationDemo> createState() => _MarkdownSerializationDemoState();
}

class _MarkdownSerializationDemoState extends State<MarkdownSerializationDemo> {
Expand Down
2 changes: 1 addition & 1 deletion super_editor/example/lib/demos/demo_paragraphs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:super_editor/super_editor.dart';
/// Example of various paragraph configurations in an editor.
class ParagraphsDemo extends StatefulWidget {
@override
_ParagraphsDemoState createState() => _ParagraphsDemoState();
State<ParagraphsDemo> createState() => _ParagraphsDemoState();
}

class _ParagraphsDemoState extends State<ParagraphsDemo> {
Expand Down
2 changes: 1 addition & 1 deletion super_editor/example/lib/demos/demo_rtl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:super_editor/super_editor.dart';
/// package expands.
class RTLDemo extends StatefulWidget {
@override
_RTLDemoState createState() => _RTLDemoState();
State<RTLDemo> createState() => _RTLDemoState();
}

class _RTLDemoState extends State<RTLDemo> {
Expand Down
2 changes: 1 addition & 1 deletion super_editor/example/lib/demos/demo_selectable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:super_text_layout/super_text_layout.dart';
/// Demo of a variety of `SelectableText` configurations.
class SelectableTextDemo extends StatefulWidget {
@override
_SelectableTextDemoState createState() => _SelectableTextDemoState();
State<SelectableTextDemo> createState() => _SelectableTextDemoState();
}

class _SelectableTextDemoState extends State<SelectableTextDemo> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:super_editor/super_editor.dart';
/// when its content is replaced.
class SwitchDocumentDemo extends StatefulWidget {
@override
_SwitchDocumentDemoState createState() => _SwitchDocumentDemoState();
State<SwitchDocumentDemo> createState() => _SwitchDocumentDemoState();
}

class _SwitchDocumentDemoState extends State<SwitchDocumentDemo> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'keyboard_overlay_clipper.dart';
/// no matter which platform or form factor you use.
class MobileEditingAndroidDemo extends StatefulWidget {
@override
_MobileEditingAndroidDemoState createState() => _MobileEditingAndroidDemoState();
State<MobileEditingAndroidDemo> createState() => _MobileEditingAndroidDemoState();
}

class _MobileEditingAndroidDemoState extends State<MobileEditingAndroidDemo> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:super_editor/super_editor.dart';
/// no matter which platform or form factor you use.
class MobileEditingIOSDemo extends StatefulWidget {
@override
_MobileEditingIOSDemoState createState() => _MobileEditingIOSDemoState();
State<MobileEditingIOSDemo> createState() => _MobileEditingIOSDemoState();
}

class _MobileEditingIOSDemoState extends State<MobileEditingIOSDemo> {
Expand Down
8 changes: 4 additions & 4 deletions super_editor/example/lib/demos/example_editor/_toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class EditorToolbar extends StatefulWidget {
final VoidCallback closeToolbar;

@override
_EditorToolbarState createState() => _EditorToolbarState();
State<EditorToolbar> createState() => _EditorToolbarState();
}

class _EditorToolbarState extends State<EditorToolbar> {
Expand Down Expand Up @@ -617,9 +617,9 @@ class _EditorToolbarState extends State<EditorToolbar> {
inputSource: TextInputSource.ime,
hintBehavior: HintBehavior.displayHintUntilTextEntered,
hintBuilder: (context) {
return Text(
return const Text(
"enter a url...",
style: const TextStyle(
style: TextStyle(
color: Colors.grey,
fontSize: 16,
),
Expand Down Expand Up @@ -723,7 +723,7 @@ class ImageFormatToolbar extends StatefulWidget {
final VoidCallback closeToolbar;

@override
_ImageFormatToolbarState createState() => _ImageFormatToolbarState();
State<ImageFormatToolbar> createState() => _ImageFormatToolbarState();
}

class _ImageFormatToolbarState extends State<ImageFormatToolbar> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import '_toolbar.dart';
/// capabilities expand.
class ExampleEditor extends StatefulWidget {
@override
_ExampleEditorState createState() => _ExampleEditorState();
State<ExampleEditor> createState() => _ExampleEditorState();
}

class _ExampleEditorState extends State<ExampleEditor> {
Expand All @@ -30,7 +30,7 @@ class _ExampleEditorState extends State<ExampleEditor> {

final _darkBackground = const Color(0xFF222222);
final _lightBackground = Colors.white;
ValueNotifier<Brightness> _brightness = ValueNotifier<Brightness>(Brightness.light);
final _brightness = ValueNotifier<Brightness>(Brightness.light);

SuperEditorDebugVisualsConfig? _debugConfig;

Expand Down Expand Up @@ -366,7 +366,7 @@ class _ExampleEditorState extends State<ExampleEditor> {
setState(() {
_debugConfig = _debugConfig != null
? null
: SuperEditorDebugVisualsConfig(
: const SuperEditorDebugVisualsConfig(
showFocus: true,
showImeConnection: true,
);
Expand Down Expand Up @@ -412,7 +412,7 @@ class _ExampleEditorState extends State<ExampleEditor> {
documentLayoutKey: _docLayoutKey,
documentOverlayBuilders: [
DefaultCaretOverlayBuilder(
CaretStyle().copyWith(color: isLight ? Colors.black : Colors.redAccent),
const CaretStyle().copyWith(color: isLight ? Colors.black : Colors.redAccent),
),
],
selectionStyle: isLight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class _PanelBehindKeyboardDemoState extends State<PanelBehindKeyboardDemo> {
_keyboardController.close();

_editor.execute([
ClearSelectionRequest(),
const ClearSelectionRequest(),
]);

// If we clear SuperEditor's selection, but leave SuperEditor focused, then
Expand All @@ -180,10 +180,10 @@ class _PanelBehindKeyboardDemoState extends State<PanelBehindKeyboardDemo> {
document: _doc,
composer: _composer,
softwareKeyboardController: _keyboardController,
selectionPolicies: SuperEditorSelectionPolicies(
selectionPolicies: const SuperEditorSelectionPolicies(
clearSelectionWhenEditorLosesFocus: false,
),
imePolicies: SuperEditorImePolicies(
imePolicies: const SuperEditorImePolicies(
openKeyboardOnSelectionChange: false,
),
),
Expand All @@ -193,7 +193,7 @@ class _PanelBehindKeyboardDemoState extends State<PanelBehindKeyboardDemo> {
left: 0,
right: 0,
bottom: 0,
child: BehindKeyboardPanel(
child: _BehindKeyboardPanel(
keyboardState: _keyboardState,
nonKeyboardEditorState: _nonKeyboardEditorState,
onOpenKeyboard: _openKeyboard,
Expand All @@ -207,8 +207,8 @@ class _PanelBehindKeyboardDemoState extends State<PanelBehindKeyboardDemo> {
}
}

class BehindKeyboardPanel extends StatefulWidget {
const BehindKeyboardPanel({
class _BehindKeyboardPanel extends StatefulWidget {
const _BehindKeyboardPanel({
Key? key,
required this.keyboardState,
required this.nonKeyboardEditorState,
Expand All @@ -224,10 +224,10 @@ class BehindKeyboardPanel extends StatefulWidget {
final VoidCallback onEndEditing;

@override
State<BehindKeyboardPanel> createState() => _BehindKeyboardPanelState();
State<_BehindKeyboardPanel> createState() => __BehindKeyboardPanelState();
}

class _BehindKeyboardPanelState extends State<BehindKeyboardPanel> {
class __BehindKeyboardPanelState extends State<_BehindKeyboardPanel> {
double _maxBottomInsets = 0.0;
double _latestBottomInsets = 0.0;

Expand All @@ -236,7 +236,7 @@ class _BehindKeyboardPanelState extends State<BehindKeyboardPanel> {
super.didChangeDependencies();

final newBottomInset = MediaQuery.of(context).viewInsets.bottom;
print("BehindKeyboardPanel didChangeDependencies() - bottom inset: $newBottomInset");
print("_BehindKeyboardPanel didChangeDependencies() - bottom inset: $newBottomInset");
if (newBottomInset > _maxBottomInsets) {
print("Setting max bottom insets to: $newBottomInset");
_maxBottomInsets = newBottomInset;
Expand Down Expand Up @@ -296,9 +296,9 @@ class _BehindKeyboardPanelState extends State<BehindKeyboardPanel> {
const SizedBox(width: 24),
GestureDetector(
onTap: _closeKeyboardAndPanel,
child: Icon(Icons.close),
child: const Icon(Icons.close),
),
Spacer(),
const Spacer(),
GestureDetector(
onTap: widget.keyboardState.value == _InputState.open ? widget.onCloseKeyboard : widget.onOpenKeyboard,
child: Icon(widget.keyboardState.value == _InputState.open ? Icons.keyboard_hide : Icons.keyboard),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/rendering.dart';

class TextInlineWidgetDemo extends StatefulWidget {
@override
_TextInlineWidgetDemoState createState() => _TextInlineWidgetDemoState();
State<TextInlineWidgetDemo> createState() => _TextInlineWidgetDemoState();
}

class _TextInlineWidgetDemoState extends State<TextInlineWidgetDemo> {
Expand Down Expand Up @@ -107,10 +107,10 @@ class _TextInlineWidgetDemoState extends State<TextInlineWidgetDemo> {
shape: StadiumBorder(),
color: Colors.yellow,
),
child: Row(
child: const Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: const [
children: [
Icon(
Icons.account_circle,
size: 14,
Expand All @@ -136,10 +136,10 @@ class _TextInlineWidgetDemoState extends State<TextInlineWidgetDemo> {
}

Widget _buildProgressExample() {
return SelectableText.rich(
return const SelectableText.rich(
TextSpan(
text: "This is a multi-step item with progress",
style: const TextStyle(
style: TextStyle(
color: Colors.black,
),
children: [
Expand All @@ -148,7 +148,7 @@ class _TextInlineWidgetDemoState extends State<TextInlineWidgetDemo> {
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: const [
children: [
SizedBox(width: 8),
Icon(Icons.check_circle, color: Colors.green, size: 14),
SizedBox(width: 4),
Expand Down
Loading

0 comments on commit 6c70c59

Please sign in to comment.