Skip to content

Commit f9df364

Browse files
committed
feat: update dependencies, ui and linting
1 parent 575fa48 commit f9df364

16 files changed

+332
-315
lines changed
Lines changed: 25 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,29 @@
1-
include: package:pedantic/analysis_options.yaml
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
27

3-
analyzer:
4-
exclude:
5-
- lib/**/*.g.dart
6-
- example/*
7-
- test/*
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
811

912
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at
17+
# https://dart-lang.github.io/linter/lints/index.html.
18+
#
19+
# Instead of disabling a lint rule for the entire project in the
20+
# section below, it can also be suppressed for a single line of code
21+
# or a specific dart file by using the `// ignore: name_of_lint` and
22+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23+
# producing the lint.
1024
rules:
11-
# these rules are documented on and in the same order as
12-
# the Dart Lint rules page to make maintenance easier
13-
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
14-
# - always_declare_return_types
15-
# - always_specify_types
16-
# - annotate_overrides
17-
# - avoid_as
18-
- avoid_empty_else
19-
- avoid_init_to_null
20-
- avoid_return_types_on_setters
21-
- avoid_web_libraries_in_flutter
22-
- await_only_futures
23-
- camel_case_types
24-
- cancel_subscriptions
25-
- close_sinks
26-
# - comment_references # we do not presume as to what people want to reference in their dartdocs
27-
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
28-
- control_flow_in_finally
29-
- empty_constructor_bodies
30-
- empty_statements
31-
- hash_and_equals
32-
- implementation_imports
33-
# - invariant_booleans
34-
# - iterable_contains_unrelated_type
35-
- library_names
36-
# - library_prefixes
37-
# - list_remove_unrelated_type
38-
# - literal_only_boolean_expressions
39-
- non_constant_identifier_names
40-
# - one_member_abstracts
41-
# - only_throw_errors
42-
# - overridden_fields
43-
- package_names
44-
- package_prefixed_library_names
45-
- prefer_is_not_empty
46-
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
47-
- slash_for_doc_comments
48-
# - sort_constructors_first
49-
# - sort_unnamed_constructors_first
50-
# - super_goes_last # no longer needed w/ Dart 2
51-
- test_types_in_equals
52-
- throw_in_finally
53-
# - type_annotate_public_apis # subset of always_specify_types
54-
- type_init_formals
55-
# - unawaited_futures
56-
- unnecessary_brace_in_string_interps
57-
- unnecessary_getters_setters
58-
- unnecessary_statements
59-
- unrelated_type_equality_checks
60-
- valid_regexps
25+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27+
28+
# Additional information about this file can be found at
29+
# https://dart.dev/guides/language/analysis-options

packages/imessage/lib/channel_image.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import 'package:flutter/cupertino.dart';
2-
import 'package:stream_chat_flutter/stream_chat_flutter.dart' show Channel;
2+
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'
3+
show Channel;
34

45
import 'package:imessage/utils.dart';
56

67
class ChannelImage extends StatelessWidget {
7-
const ChannelImage({Key? key, required this.channel, required this.size})
8-
: super(key: key);
8+
const ChannelImage({
9+
Key? key,
10+
required this.channel,
11+
required this.size,
12+
}) : super(key: key);
913

1014
final Channel channel;
1115
final double size;

packages/imessage/lib/channel_list_view.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import 'package:flutter/cupertino.dart';
22
import 'package:imessage/channel_preview.dart';
33
import 'package:imessage/message_page.dart';
44
import 'package:animations/animations.dart';
5-
import 'package:stream_chat_flutter/stream_chat_flutter.dart'
5+
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'
66
show Channel, StreamChannel;
77

88
class ChannelListView extends StatelessWidget {
99
const ChannelListView({Key? key, required this.channels}) : super(key: key);
1010
final List<Channel> channels;
11+
1112
@override
1213
Widget build(BuildContext context) {
1314
channels.removeWhere((channel) => channel.lastMessageAt == null);
@@ -27,7 +28,7 @@ class ChannelListView extends StatelessWidget {
2728
PageRouteBuilder(
2829
pageBuilder: (_, __, ___) => StreamChannel(
2930
channel: channels[index],
30-
child: MessagePage(),
31+
child: const MessagePage(),
3132
),
3233
transitionsBuilder: (
3334
_,

packages/imessage/lib/channel_name_text.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
import 'package:flutter/cupertino.dart';
2-
import 'package:stream_chat_flutter/stream_chat_flutter.dart' show Channel;
2+
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'
3+
show Channel;
34

45
class ChannelNameText extends StatelessWidget {
56
const ChannelNameText({
67
Key? key,
78
required this.channel,
89
this.size = 17,
10+
this.fontWeight,
911
}) : super(key: key);
1012

1113
final Channel channel;
1214
final double size;
15+
final FontWeight? fontWeight;
1316

1417
@override
1518
Widget build(BuildContext context) {
1619
return Text(
1720
channel.extraData['name'] as String? ?? 'No name',
1821
style: TextStyle(
1922
fontSize: size,
20-
fontWeight: FontWeight.bold,
23+
fontWeight: fontWeight,
2124
color: CupertinoColors.black,
2225
),
2326
);

packages/imessage/lib/channel_page_appbar.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ class ChannelPageAppBar extends StatelessWidget {
77

88
@override
99
Widget build(BuildContext context) {
10-
return CupertinoSliverNavigationBar(
11-
largeTitle: Text('Messages'),
10+
return const CupertinoSliverNavigationBar(
11+
largeTitle: Text(
12+
'Messages',
13+
style: TextStyle(letterSpacing: -1.3),
14+
),
1215
);
1316
}
1417
}

packages/imessage/lib/channel_preview.dart

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import 'package:flutter/cupertino.dart';
22
import 'package:imessage/channel_image.dart';
33
import 'package:imessage/channel_name_text.dart';
44
import 'package:imessage/utils.dart';
5-
import 'package:stream_chat_flutter/stream_chat_flutter.dart' show Channel;
5+
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'
6+
show Channel;
67

78
import 'utils.dart';
89

@@ -23,7 +24,7 @@ class ChannelPreview extends StatelessWidget {
2324
: null;
2425

2526
final prefix = lastMessage?.attachments != null
26-
? lastMessage?.attachments //TODO: ugly
27+
? lastMessage?.attachments
2728
.map((e) {
2829
if (e.type == 'image') {
2930
return '📷 ';
@@ -35,13 +36,12 @@ class ChannelPreview extends StatelessWidget {
3536
.where((e) => e != null)
3637
.join(' ')
3738
: '';
39+
3840
return GestureDetector(
3941
onTap: onTap,
4042
behavior: HitTestBehavior.opaque,
41-
child: Container(
42-
constraints: BoxConstraints.tightFor(
43-
height: 90,
44-
),
43+
child: SizedBox(
44+
height: 70,
4545
child: Padding(
4646
padding: const EdgeInsets.symmetric(
4747
horizontal: 8.0,
@@ -50,11 +50,10 @@ class ChannelPreview extends StatelessWidget {
5050
crossAxisAlignment: CrossAxisAlignment.start,
5151
children: [
5252
Padding(
53-
padding:
54-
const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8.0),
53+
padding: const EdgeInsets.only(left: 16.0, right: 8.0),
5554
child: ChannelImage(
5655
channel: channel,
57-
size: 50,
56+
size: 46,
5857
),
5958
),
6059
Expanded(
@@ -67,47 +66,49 @@ class ChannelPreview extends StatelessWidget {
6766
crossAxisAlignment: CrossAxisAlignment.start,
6867
children: [
6968
Padding(
70-
padding: const EdgeInsets.symmetric(horizontal: 8.0),
71-
child: ChannelNameText(
72-
channel: channel,
73-
),
69+
padding: const EdgeInsets.symmetric(horizontal: 4.0),
70+
child: ChannelNameText(channel: channel),
7471
),
7572
Padding(
76-
padding: const EdgeInsets.symmetric(horizontal: 8.0),
73+
padding: const EdgeInsets.symmetric(horizontal: 4.0),
7774
child: Row(
7875
children: [
7976
Text(
8077
isSameWeek(channel.lastMessageAt!)
8178
? formatDateSameWeek(channel.lastMessageAt!)
8279
: formatDate(channel.lastMessageAt!),
83-
style: TextStyle(
84-
fontSize: 15,
80+
style: const TextStyle(
81+
fontSize: 13,
8582
color: CupertinoColors.systemGrey,
8683
),
8784
),
88-
Icon(
89-
CupertinoIcons.right_chevron,
90-
color: CupertinoColors.systemGrey3,
85+
const Padding(
86+
padding: EdgeInsets.only(left: 4.0),
87+
child: Icon(
88+
CupertinoIcons.chevron_right,
89+
size: 16,
90+
color: CupertinoColors.systemGrey3,
91+
),
9192
),
9293
],
9394
),
9495
)
9596
],
9697
),
9798
Padding(
98-
padding: const EdgeInsets.all(8.0),
99+
padding: const EdgeInsets.all(4.0),
99100
child: Text(
100101
'$prefix${lastMessage?.text ?? ''}',
101-
style: TextStyle(
102+
style: const TextStyle(
102103
fontWeight: FontWeight.normal,
103104
color: CupertinoColors.systemGrey,
104-
fontSize: 16,
105+
fontSize: 14,
105106
),
106107
maxLines: 2,
107108
overflow: TextOverflow.ellipsis,
108109
),
109110
),
110-
Divider(),
111+
const Divider(),
111112
],
112113
),
113114
)

0 commit comments

Comments
 (0)