Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding flutter_lints #227

Merged
merged 5 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 4 additions & 2 deletions super_editor/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
include: package:pedantic/analysis_options.1.11.0.yaml
include: package:flutter_lints/flutter.yaml

analyzer:
exclude: [build/**]

linter:
rules:
omit_local_variable_types: false
avoid_print: false
omit_local_variable_types: false
use_key_in_widget_constructors: false
6 changes: 4 additions & 2 deletions super_editor/example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
include: package:pedantic/analysis_options.yaml
include: package:flutter_lints/flutter.yaml

analyzer:
exclude: [lib/spikes]

linter:
rules:
omit_local_variable_types: false
avoid_print: false
omit_local_variable_types: false
use_key_in_widget_constructors: false
26 changes: 13 additions & 13 deletions super_editor/example/lib/demos/demo_attributed_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@ class _AttributedTextDemoState extends State<AttributedTextDemo> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(left: 20.0),
const Padding(
padding: EdgeInsets.only(left: 20.0),
child: Text(
'AttributedText',
style: TextStyle(
color: const Color(0xFF888888),
color: Color(0xFF888888),
fontSize: 32,
),
),
),
SizedBox(height: 4),
Padding(
padding: const EdgeInsets.only(left: 20.0),
const SizedBox(height: 4),
const Padding(
padding: EdgeInsets.only(left: 20.0),
child: Text(
'''AttributedText is a data structure that supports an arbitrary number of
"attribution spans". These attributions can be anything, and mean anything.
Expand All @@ -90,21 +90,21 @@ That TextSpan can then be rendered by Flutter, as usual.

Try it yourself by adding and removing attributions to characters in a string...''',
style: TextStyle(
color: const Color(0xFF888888),
color: Color(0xFF888888),
fontSize: 14,
height: 1.4,
fontWeight: FontWeight.normal,
),
),
),
SizedBox(height: 24),
SizedBox(
const SizedBox(height: 24),
const SizedBox(
width: 600,
child: Divider(),
),
SizedBox(height: 24),
const SizedBox(height: 24),
Table(
defaultColumnWidth: IntrinsicColumnWidth(),
defaultColumnWidth: const IntrinsicColumnWidth(),
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
children: [
TableRow(
Expand All @@ -125,7 +125,7 @@ Try it yourself by adding and removing attributions to characters in a string...
_buildCellSelector(_strikethroughRanges),
],
),
TableRow(
const TableRow(
children: [
SizedBox(height: 24),
SizedBox(height: 24),
Expand All @@ -136,7 +136,7 @@ Try it yourself by adding and removing attributions to characters in a string...
_buildRowTitle('Attributed Text'),
SuperSelectableText(
key: GlobalKey(),
textSpan: _richText ?? TextSpan(text: 'error'),
textSpan: _richText ?? const TextSpan(text: 'error'),
),
],
),
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 @@ -46,8 +46,8 @@ class _LoseFocusDemoState extends State<LoseFocusDemo> {
}

Widget _buildDocSelector() {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 48.0),
return const Padding(
padding: EdgeInsets.symmetric(horizontal: 48.0),
child: TextField(
decoration: InputDecoration(
hintText: 'tap to give focus to this TextField',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ class _MarkdownSerializationDemoState extends State<MarkdownSerializationDemo> {
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 24),
child: Text(
_markdown,
style: TextStyle(
color: const Color(0xFFEEEEEE),
style: const TextStyle(
color: Color(0xFFEEEEEE),
height: 1.4,
),
),
Expand Down
36 changes: 18 additions & 18 deletions super_editor/example/lib/demos/demo_selectable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class SelectableTextDemo extends StatefulWidget {
}

class _SelectableTextDemoState extends State<SelectableTextDemo> {
final _demoText1 = TextSpan(
final _demoText1 = const TextSpan(
text: 'Super Editor',
style: TextStyle(
color: const Color(0xFF444444),
color: Color(0xFF444444),
fontSize: 18,
height: 1.4,
fontWeight: FontWeight.bold,
Expand All @@ -20,7 +20,7 @@ class _SelectableTextDemoState extends State<SelectableTextDemo> {
TextSpan(
text: ' is an open source text editor for Flutter projects.',
style: TextStyle(
color: const Color(0xFF444444),
color: Color(0xFF444444),
fontSize: 18,
height: 1.4,
fontWeight: FontWeight.normal,
Expand All @@ -43,28 +43,28 @@ class _SelectableTextDemoState extends State<SelectableTextDemo> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildTitle('SuperSelectableText Widget'),
SizedBox(height: 24),
const SizedBox(height: 24),
_buildDemo(
title: 'EMPTY TEXT WITH CARET',
demo: SuperSelectableText.plain(
text: '',
textSelection: TextSelection.collapsed(offset: 0),
textSelection: const TextSelection.collapsed(offset: 0),
showCaret: true,
style: TextStyle(
color: const Color(0xFF444444),
style: const TextStyle(
color: Color(0xFF444444),
fontSize: 18,
height: 1.4,
),
),
),
SizedBox(height: 24),
const SizedBox(height: 24),
_buildDemo(
title: 'TEXT WITHOUT SELECTION OR CARET',
demo: SuperSelectableText(
textSpan: _demoText1,
),
),
SizedBox(height: 24),
const SizedBox(height: 24),
_buildDemo(
title: 'TEXT WITH CARET + COLLAPSED SELECTION',
demo: SuperSelectableText(
Expand All @@ -73,7 +73,7 @@ class _SelectableTextDemoState extends State<SelectableTextDemo> {
showCaret: true,
),
),
SizedBox(height: 24),
const SizedBox(height: 24),
_buildDemo(
title: 'TEXT WITH LEFT-TO-RIGHT SELECTION + CARET',
demo: SuperSelectableText(
Expand All @@ -82,7 +82,7 @@ class _SelectableTextDemoState extends State<SelectableTextDemo> {
showCaret: true,
),
),
SizedBox(height: 24),
const SizedBox(height: 24),
_buildDemo(
title: 'TEXT WITH RIGHT-TO-LEFT SELECTION + CARET',
demo: SuperSelectableText(
Expand All @@ -93,7 +93,7 @@ class _SelectableTextDemoState extends State<SelectableTextDemo> {
showCaret: true,
),
),
SizedBox(height: 24),
const SizedBox(height: 24),
_buildDemo(
title: 'TEXT WITH FULL SELECTION + CARET, CUSTOM COLORS, CARET SHAPE, DEBUG PAINT',
demo: DebugSelectableTextDecorator(
Expand All @@ -104,7 +104,7 @@ class _SelectableTextDemoState extends State<SelectableTextDemo> {
key: _debugTextKey,
textSpan: _demoText1,
textSelection: TextSelection(baseOffset: 0, extentOffset: _demoText1.toPlainText().length),
textSelectionDecoration: TextSelectionDecoration(
textSelectionDecoration: const TextSelectionDecoration(
selectionColor: Colors.yellow,
),
showCaret: true,
Expand All @@ -127,8 +127,8 @@ class _SelectableTextDemoState extends State<SelectableTextDemo> {
Widget _buildTitle(String title) {
return Text(
title,
style: TextStyle(
color: const Color(0xFF444444),
style: const TextStyle(
color: Color(0xFF444444),
fontSize: 32,
),
);
Expand All @@ -144,21 +144,21 @@ class _SelectableTextDemoState extends State<SelectableTextDemo> {
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
decoration: const BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
)),
child: Text(
title,
style: TextStyle(
style: const TextStyle(
color: Colors.white,
fontSize: 10,
fontWeight: FontWeight.bold,
),
),
),
SizedBox(height: 4),
const SizedBox(height: 4),
demo,
],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ class _SwitchDocumentDemoState extends State<SwitchDocumentDemo> {
_activeDocumentEditor = _docEditor1;
});
},
child: Text('Document 1'),
child: const Text('Document 1'),
),
SizedBox(width: 24),
const SizedBox(width: 24),
TextButton(
onPressed: () {
setState(() {
_activeDocumentEditor = _docEditor2;
});
},
child: Text('Document 2'),
child: const Text('Document 2'),
),
],
);
Expand Down
Loading