chore: update package lints and apply fixes

This commit is contained in:
Gordon Hayes
2022-10-06 14:31:51 +02:00
parent fe029b35d0
commit 3ae658e204
29 changed files with 481 additions and 462 deletions
@@ -13,21 +13,23 @@ import '../pages/chat_info_screen.dart';
import '../pages/group_info_screen.dart';
class ChannelList extends StatefulWidget {
const ChannelList({super.key});
@override
_ChannelList createState() => _ChannelList();
State<ChannelList> createState() => _ChannelList();
}
class _ChannelList extends State<ChannelList> {
ScrollController _scrollController = ScrollController();
final ScrollController _scrollController = ScrollController();
late StreamMessageSearchListController _messageSearchListController =
late final StreamMessageSearchListController _messageSearchListController =
StreamMessageSearchListController(
client: StreamChat.of(context).client,
filter: Filter.in_('members', [StreamChat.of(context).currentUser!.id]),
limit: 5,
searchQuery: '',
sort: [
SortOption(
const SortOption(
'created_at',
direction: SortOption.ASC,
),
@@ -116,7 +118,7 @@ class _ChannelList extends State<ChannelList> {
return LayoutBuilder(
builder: (context, viewportConstraints) {
return SingleChildScrollView(
physics: AlwaysScrollableScrollPhysics(),
physics: const AlwaysScrollableScrollPhysics(),
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: viewportConstraints.maxHeight,
@@ -153,6 +155,7 @@ class _ChannelList extends State<ChannelList> {
final messageResponse = messageResponses[index];
FocusScope.of(context).requestFocus(FocusNode());
final client = StreamChat.of(context).client;
final navigator = Navigator.of(context);
final message = messageResponse.message;
final channel = client.channel(
messageResponse.channel!.type,
@@ -161,8 +164,7 @@ class _ChannelList extends State<ChannelList> {
if (channel.state == null) {
await channel.watch();
}
Navigator.pushNamed(
context,
navigator.pushNamed(
Routes.CHANNEL_PAGE,
arguments: ChannelPageArgs(
channel: channel,
@@ -192,7 +194,6 @@ class _ChannelList extends State<ChannelList> {
motion: const BehindMotion(),
children: [
CustomSlidableAction(
child: Icon(Icons.more_horiz),
backgroundColor: backgroundColor,
onPressed: (_) {
showChannelInfoModalBottomSheet(
@@ -236,6 +237,7 @@ class _ChannelList extends State<ChannelList> {
},
);
},
child: const Icon(Icons.more_horiz),
),
if (canDeleteChannel)
CustomSlidableAction(
@@ -68,97 +68,95 @@ class ChipInputTextFieldState<T> extends State<ChipsInputTextField<T>> {
child: Material(
elevation: 1,
color: StreamChatTheme.of(context).colorTheme.barsBg,
child: Container(
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 16),
child: Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Text(
'${AppLocalizations.of(context).to.toUpperCase()}:',
style: StreamChatTheme.of(context)
.textTheme
.footnote
.copyWith(
color: StreamChatTheme.of(context)
.colorTheme
.textHighEmphasis
.withOpacity(.5)),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 16),
child: Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: Text(
'${AppLocalizations.of(context).to.toUpperCase()}:',
style: StreamChatTheme.of(context)
.textTheme
.footnote
.copyWith(
color: StreamChatTheme.of(context)
.colorTheme
.textHighEmphasis
.withOpacity(.5)),
),
SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Wrap(
spacing: 8.0,
runSpacing: 4.0,
children: _chips.map((item) {
return widget.chipBuilder(context, item);
}).toList(),
),
if (!_pauseItemAddition)
TextField(
controller: widget.controller,
onChanged: widget.onInputChanged,
focusNode: widget.focusNode,
decoration: InputDecoration(
isDense: true,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
contentPadding: const EdgeInsets.only(top: 4.0),
hintText: widget.hint,
hintStyle: StreamChatTheme.of(context)
.textTheme
.body
.copyWith(
color: StreamChatTheme.of(context)
.colorTheme
.textHighEmphasis
.withOpacity(.5)),
),
),
],
),
),
SizedBox(width: 12),
Align(
alignment: Alignment.bottomCenter,
child: IconButton(
icon: _chips.isEmpty
? StreamSvgIcon.user(
color: StreamChatTheme.of(context)
.colorTheme
.textHighEmphasis
.withOpacity(0.5),
size: 24,
)
: StreamSvgIcon.userAdd(
color: StreamChatTheme.of(context)
.colorTheme
.textHighEmphasis
.withOpacity(0.5),
size: 24,
),
onPressed: resumeItemAddition,
alignment: Alignment.topRight,
visualDensity: VisualDensity.compact,
padding: const EdgeInsets.all(0),
splashRadius: 24,
constraints: BoxConstraints.tightFor(
height: 24,
width: 24,
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Wrap(
spacing: 8.0,
runSpacing: 4.0,
children: _chips.map((item) {
return widget.chipBuilder(context, item);
}).toList(),
),
if (!_pauseItemAddition)
TextField(
controller: widget.controller,
onChanged: widget.onInputChanged,
focusNode: widget.focusNode,
decoration: InputDecoration(
isDense: true,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
contentPadding: const EdgeInsets.only(top: 4.0),
hintText: widget.hint,
hintStyle: StreamChatTheme.of(context)
.textTheme
.body
.copyWith(
color: StreamChatTheme.of(context)
.colorTheme
.textHighEmphasis
.withOpacity(.5)),
),
),
],
),
),
const SizedBox(width: 12),
Align(
alignment: Alignment.bottomCenter,
child: IconButton(
icon: _chips.isEmpty
? StreamSvgIcon.user(
color: StreamChatTheme.of(context)
.colorTheme
.textHighEmphasis
.withOpacity(0.5),
size: 24,
)
: StreamSvgIcon.userAdd(
color: StreamChatTheme.of(context)
.colorTheme
.textHighEmphasis
.withOpacity(0.5),
size: 24,
),
onPressed: resumeItemAddition,
alignment: Alignment.topRight,
visualDensity: VisualDensity.compact,
padding: const EdgeInsets.all(0),
splashRadius: 24,
constraints: const BoxConstraints.tightFor(
height: 24,
width: 24,
),
),
],
),
),
],
),
),
),
@@ -41,7 +41,7 @@ class SearchTextField extends StatelessWidget {
onChanged: onChanged,
decoration: InputDecoration(
prefixText: ' ',
prefixIconConstraints: BoxConstraints.tight(Size(40, 24)),
prefixIconConstraints: BoxConstraints.tight(const Size(40, 24)),
prefixIcon: Padding(
padding: const EdgeInsets.only(
left: 8,
@@ -18,7 +18,7 @@ class StreamVersion extends StatelessWidget {
future: rootBundle.loadString('pubspec.lock'),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return SizedBox();
return const SizedBox();
}
final pubspec = snapshot.data!;