Skip to content

Commit

Permalink
update lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Fintasys committed Nov 14, 2024
1 parent d103470 commit 46c15bd
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 56 deletions.
4 changes: 4 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
include: package:flutter_lints/flutter.yaml

analyzer:
language:
strict-casts: true
strict-raw-types: true
errors:
close_sinks: ignore
constant_identifier_names: ignore
no_leading_underscores_for_local_identifiers: ignore

linter:
rules:
Expand Down
2 changes: 1 addition & 1 deletion lib/emoji_picker_flutter.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
library emoji_picker_flutter;
library;

export 'package:emoji_picker_flutter/locales/emoji_set.dart';
export 'package:emoji_picker_flutter/src/bottom_action_bar/bottom_action_bar.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/src/bottom_action_bar/bottom_action_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ abstract class BottomActionBar extends StatefulWidget {
this.config,
this.state,
this.showSearchView, {
Key? key,
}) : super(key: key);
super.key,
});

/// Config for customizations
final Config config;
Expand Down
5 changes: 2 additions & 3 deletions lib/src/bottom_action_bar/default_bottom_action_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import 'package:flutter/material.dart';
/// Default Bottom Action Bar implementation
class DefaultBottomActionBar extends BottomActionBar {
/// Constructor
DefaultBottomActionBar(
Config config, EmojiViewState state, VoidCallback showSearchView)
: super(config, state, showSearchView);
const DefaultBottomActionBar(super.config, super.state, super.showSearchView,
{super.key});

@override
State<StatefulWidget> createState() => _DefaultBottomActionBarState();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/category_view/category_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ abstract class CategoryView extends StatefulWidget {
this.state,
this.tabController,
this.pageController, {
Key? key,
}) : super(key: key);
super.key,
});

/// Config for customizations
final Config config;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/category_view/default_category_tab_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class DefaultCategoryTabBar extends StatelessWidget {
this.pageController,
this.categoryEmojis,
this.closeSkinToneOverlay, {
Key? key,
}) : super(key: key);
super.key,
});

/// Config
final Config config;
Expand Down
14 changes: 7 additions & 7 deletions lib/src/category_view/default_category_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import 'package:flutter/material.dart';
/// Default category view
class DefaultCategoryView extends CategoryView {
/// Constructor
DefaultCategoryView(
Config config,
EmojiViewState state,
TabController tabController,
PageController pageController, {
Key? key,
}) : super(config, state, tabController, pageController, key: key);
const DefaultCategoryView(
super.config,
super.state,
super.tabController,
super.pageController, {
super.key,
});

@override
DefaultCategoryViewState createState() => DefaultCategoryViewState();
Expand Down
14 changes: 7 additions & 7 deletions lib/src/emoji_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ enum ButtonMode {
/// The function returns the selected [Emoji] as well
/// as the [Category] from which it originated
/// Category can be null in some cases, for example in search results
typedef void OnEmojiSelected(Category? category, Emoji emoji);
typedef OnEmojiSelected = void Function(Category? category, Emoji emoji);

/// Callback from emoji cell to show a skin tone selection overlay
typedef void OnSkinToneDialogRequested(Offset emojiBoxPosition, Emoji emoji,
double emojiSize, CategoryEmoji? categoryEmoji);
typedef OnSkinToneDialogRequested = void Function(Offset emojiBoxPosition,
Emoji emoji, double emojiSize, CategoryEmoji? categoryEmoji);

/// Callback function for backspace button
typedef void OnBackspacePressed();
typedef OnBackspacePressed = void Function();

/// Callback function for backspace button when long pressed
typedef void OnBackspaceLongPressed();
typedef OnBackspaceLongPressed = void Function();

/// The Emoji Keyboard widget
///
Expand All @@ -105,14 +105,14 @@ typedef void OnBackspaceLongPressed();
class EmojiPicker extends StatefulWidget {
/// EmojiPicker for flutter
const EmojiPicker({
Key? key,
super.key,
this.textEditingController,
this.scrollController,
this.onEmojiSelected,
this.onBackspacePressed,
this.config = const Config(),
this.customWidget,
}) : super(key: key);
});

/// Custom widget
final EmojiViewBuilder? customWidget;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/emoji_picker_internal_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class EmojiPickerInternalUtils {
Emoji removeSkinTone(Emoji emoji) {
return emoji.copyWith(
emoji: emoji.emoji.replaceFirst(
RegExp('${SkinTone.values.join('|')}'),
RegExp(SkinTone.values.join('|')),
'',
),
);
Expand Down
3 changes: 1 addition & 2 deletions lib/src/emoji_text_editing_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ const delimiter = '|';
/// a particular style to emoji characters.
class EmojiTextEditingController extends TextEditingController {
/// Constructor, requres emojiStyle, since otherwise this class has no effect
EmojiTextEditingController({String? text, required this.emojiTextStyle})
: super(text: text);
EmojiTextEditingController({super.text, required this.emojiTextStyle});

/// The style used for the emoji characters
final TextStyle emojiTextStyle;
Expand Down
9 changes: 3 additions & 6 deletions lib/src/emoji_view/default_emoji_picker_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ import 'package:flutter/material.dart';
/// Default EmojiPicker Implementation
class DefaultEmojiPickerView extends EmojiPickerView {
/// Constructor
DefaultEmojiPickerView(
Config config,
EmojiViewState state,
VoidCallback showSearchBar,
) : super(config, state, showSearchBar);
const DefaultEmojiPickerView(super.config, super.state, super.showSearchBar,
{super.key});

@override
_DefaultEmojiPickerViewState createState() => _DefaultEmojiPickerViewState();
State<DefaultEmojiPickerView> createState() => _DefaultEmojiPickerViewState();
}

class _DefaultEmojiPickerViewState extends State<DefaultEmojiPickerView>
Expand Down
1 change: 1 addition & 0 deletions lib/src/emoji_view/emoji_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:flutter/material.dart';
class EmojiContainer extends StatelessWidget {
/// Constructor
const EmojiContainer({
super.key,
required this.color,
required this.buttonMode,
this.padding,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/emoji_view/emoji_picker_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ abstract class EmojiPickerView extends StatefulWidget {
this.config,
this.state,
this.showSearchBar, {
Key? key,
}) : super(key: key);
super.key,
});

/// Config for customizations
final Config config;
Expand Down
7 changes: 2 additions & 5 deletions lib/src/search_view/default_search_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ import 'package:flutter/material.dart';
/// Default Search implementation
class DefaultSearchView extends SearchView {
/// Constructor
const DefaultSearchView(
Config config,
EmojiViewState state,
VoidCallback showEmojiView,
) : super(config, state, showEmojiView);
const DefaultSearchView(super.config, super.state, super.showEmojiView,
{super.key});

@override
DefaultSearchViewState createState() => DefaultSearchViewState();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/search_view/search_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ abstract class SearchView extends StatefulWidget {
this.config,
this.state,
this.showEmojiView, {
Key? key,
}) : super(key: key);
super.key,
});

/// Config for customizations
final Config config;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/skin_tones/triangle_decoration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
/// corner of a container
class TriangleDecoration extends Decoration {
/// Constructor
TriangleDecoration({required this.color, required this.size}) : super();
const TriangleDecoration({required this.color, required this.size}) : super();

/// Color of the triangle
final Color color;
Expand Down
16 changes: 9 additions & 7 deletions lib/src/widgets/emoji_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
class EmojiCell extends StatelessWidget {
/// Constructor for manually setting all properties
const EmojiCell({
super.key,
required this.emoji,
required this.emojiSize,
required this.emojiBoxSize,
Expand All @@ -23,7 +24,8 @@ class EmojiCell extends StatelessWidget {
/// Constructor that can retrieve as much information as possible from
/// [Config]
EmojiCell.fromConfig(
{required this.emoji,
{super.key,
required this.emoji,
required this.emojiSize,
required this.emojiBoxSize,
this.categoryEmoji,
Expand Down Expand Up @@ -69,11 +71,11 @@ class EmojiCell extends StatelessWidget {

@override
Widget build(BuildContext context) {
final onPressed = () {
onPressed() {
onEmojiSelected(categoryEmoji?.category, emoji);
};
}

final onLongPressed = () {
onLongPressed() {
final renderBox = context.findRenderObject() as RenderBox;
final emojiBoxPosition = renderBox.localToGlobal(Offset.zero);
onSkinToneDialogRequested?.call(
Expand All @@ -82,7 +84,7 @@ class EmojiCell extends StatelessWidget {
emojiSize,
categoryEmoji,
);
};
}

return SizedBox(
width: emojiBoxSize,
Expand All @@ -105,13 +107,13 @@ class EmojiCell extends StatelessWidget {
return MaterialButton(
onPressed: onPressed,
onLongPress: onLongPressed,
child: child,
elevation: 0,
highlightElevation: 0,
padding: EdgeInsets.zero,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.zero,
),
child: child,
);
}
if (buttonMode == ButtonMode.CUPERTINO) {
Expand All @@ -120,8 +122,8 @@ class EmojiCell extends StatelessWidget {
child: CupertinoButton(
onPressed: onPressed,
padding: EdgeInsets.zero,
child: child,
alignment: Alignment.center,
child: child,
),
);
}
Expand Down
10 changes: 5 additions & 5 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ packages:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c"
sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
version: "5.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -217,10 +217,10 @@ packages:
dependency: transitive
description:
name: lints
sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235"
sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
version: "5.0.0"
logging:
dependency: transitive
description:
Expand Down Expand Up @@ -603,5 +603,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.4.0 <4.0.0"
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.22.0"
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0
flutter_lints: ^5.0.0
test: ^1.25.7

flutter:
Expand Down

0 comments on commit 46c15bd

Please sign in to comment.