refactor: Switch to flutter_lints
This commit is contained in:
parent
9ceb811c76
commit
13fda9458f
101 changed files with 719 additions and 653 deletions
|
|
@ -45,8 +45,8 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
value: 'mute',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.notifications_off_outlined),
|
||||
SizedBox(width: 12),
|
||||
const Icon(Icons.notifications_off_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context).muteChat),
|
||||
],
|
||||
),
|
||||
|
|
@ -55,8 +55,8 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
value: 'unmute',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.notifications_on_outlined),
|
||||
SizedBox(width: 12),
|
||||
const Icon(Icons.notifications_on_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context).unmuteChat),
|
||||
],
|
||||
),
|
||||
|
|
@ -65,8 +65,8 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
value: 'leave',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.delete_outlined),
|
||||
SizedBox(width: 12),
|
||||
const Icon(Icons.delete_outlined),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context).leave),
|
||||
],
|
||||
),
|
||||
|
|
@ -79,8 +79,8 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
|||
value: 'details',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline_rounded),
|
||||
SizedBox(width: 12),
|
||||
const Icon(Icons.info_outline_rounded),
|
||||
const SizedBox(width: 12),
|
||||
Text(L10n.of(context).chatDetails),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|||
import 'matrix.dart';
|
||||
|
||||
class ConnectionStatusHeader extends StatefulWidget {
|
||||
const ConnectionStatusHeader({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ConnectionStatusHeaderState createState() => _ConnectionStatusHeaderState();
|
||||
}
|
||||
|
|
@ -19,7 +21,8 @@ class _ConnectionStatusHeaderState extends State<ConnectionStatusHeader> {
|
|||
_lastSyncReceived.millisecondsSinceEpoch <
|
||||
(Matrix.of(context).client.sendMessageTimeoutSeconds + 2) * 1000;
|
||||
static DateTime _lastSyncReceived = DateTime(0);
|
||||
SyncStatusUpdate _status = SyncStatusUpdate(SyncStatus.waitingForResponse);
|
||||
SyncStatusUpdate _status =
|
||||
const SyncStatusUpdate(SyncStatus.waitingForResponse);
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
|
@ -44,12 +47,12 @@ class _ConnectionStatusHeaderState extends State<ConnectionStatusHeader> {
|
|||
);
|
||||
|
||||
return AnimatedContainer(
|
||||
duration: Duration(milliseconds: 200),
|
||||
duration: const Duration(milliseconds: 200),
|
||||
curve: Curves.bounceInOut,
|
||||
height: _connected ? 0 : 36,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(color: Theme.of(context).secondaryHeaderColor),
|
||||
padding: EdgeInsets.symmetric(horizontal: 12),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
|
@ -61,7 +64,7 @@ class _ConnectionStatusHeaderState extends State<ConnectionStatusHeader> {
|
|||
value: _connected ? 1.0 : _status.progress,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
_status.toLocalizedString(context),
|
||||
maxLines: 1,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class _ContactsState extends State<ContactsList> {
|
|||
_lastSetState.millisecondsSinceEpoch <
|
||||
1000) {
|
||||
_coolDown?.cancel();
|
||||
_coolDown = Timer(Duration(seconds: 1), _updateView);
|
||||
_coolDown = Timer(const Duration(seconds: 1), _updateView);
|
||||
} else {
|
||||
_updateView();
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ class _ContactListTile extends StatelessWidget {
|
|||
snapshot.data?.displayName ?? contact.senderId.localpart;
|
||||
final avatarUrl = snapshot.data?.avatarUrl;
|
||||
return ListTile(
|
||||
leading: Container(
|
||||
leading: SizedBox(
|
||||
width: Avatar.defaultSize,
|
||||
height: Avatar.defaultSize,
|
||||
child: Stack(
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@ class ContentBanner extends StatelessWidget {
|
|||
),
|
||||
if (onEdit != null)
|
||||
Container(
|
||||
margin: EdgeInsets.all(8),
|
||||
margin: const EdgeInsets.all(8),
|
||||
alignment: Alignment.bottomRight,
|
||||
child: FloatingActionButton(
|
||||
mini: true,
|
||||
onPressed: onEdit,
|
||||
backgroundColor: Theme.of(context).backgroundColor,
|
||||
foregroundColor: Theme.of(context).textTheme.bodyText1.color,
|
||||
child: Icon(Icons.camera_alt_outlined),
|
||||
child: const Icon(Icons.camera_alt_outlined),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class DefaultAppBarSearchField extends StatefulWidget {
|
|||
final bool unfocusOnClear;
|
||||
final bool autocorrect;
|
||||
|
||||
DefaultAppBarSearchField({
|
||||
const DefaultAppBarSearchField({
|
||||
Key key,
|
||||
this.searchController,
|
||||
this.onChanged,
|
||||
|
|
@ -78,7 +78,7 @@ class DefaultAppBarSearchFieldState extends State<DefaultAppBarSearchField> {
|
|||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 40,
|
||||
padding: widget.padding ?? EdgeInsets.only(right: 12),
|
||||
padding: widget.padding ?? const EdgeInsets.only(right: 12),
|
||||
child: TextField(
|
||||
autofocus: widget.autofocus,
|
||||
autocorrect: widget.autocorrect,
|
||||
|
|
@ -97,7 +97,7 @@ class DefaultAppBarSearchFieldState extends State<DefaultAppBarSearchField> {
|
|||
borderSide:
|
||||
BorderSide(color: Theme.of(context).secondaryHeaderColor),
|
||||
),
|
||||
contentPadding: EdgeInsets.only(
|
||||
contentPadding: const EdgeInsets.only(
|
||||
top: 8,
|
||||
bottom: 8,
|
||||
left: 16,
|
||||
|
|
@ -110,7 +110,7 @@ class DefaultAppBarSearchFieldState extends State<DefaultAppBarSearchField> {
|
|||
(_searchController.text?.isNotEmpty ?? false)))
|
||||
? IconButton(
|
||||
tooltip: L10n.of(context).clearText,
|
||||
icon: Icon(Icons.backspace_outlined),
|
||||
icon: const Icon(Icons.backspace_outlined),
|
||||
onPressed: () {
|
||||
_searchController.clear();
|
||||
widget.onChanged?.call('');
|
||||
|
|
|
|||
|
|
@ -132,10 +132,10 @@ class _AudioPlayerState extends State<AudioPlayerWidget> {
|
|||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
SizedBox(
|
||||
width: 30,
|
||||
child: status == AudioPlayerStatus.downloading
|
||||
? CircularProgressIndicator.adaptive(strokeWidth: 2)
|
||||
? const CircularProgressIndicator.adaptive(strokeWidth: 2)
|
||||
: IconButton(
|
||||
icon: Icon(
|
||||
audioPlayer.state == PlayerState.PLAYING
|
||||
|
|
@ -172,7 +172,7 @@ class _AudioPlayerState extends State<AudioPlayerWidget> {
|
|||
color: widget.color,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.download_outlined,
|
||||
|
|
|
|||
|
|
@ -18,13 +18,15 @@ class HtmlMessage extends StatelessWidget {
|
|||
final TextStyle linkStyle;
|
||||
final double emoteSize;
|
||||
|
||||
const HtmlMessage(
|
||||
{this.html,
|
||||
this.maxLines,
|
||||
this.room,
|
||||
this.defaultTextStyle,
|
||||
this.linkStyle,
|
||||
this.emoteSize});
|
||||
const HtmlMessage({
|
||||
Key key,
|
||||
this.html,
|
||||
this.maxLines,
|
||||
this.room,
|
||||
this.defaultTextStyle,
|
||||
this.linkStyle,
|
||||
this.emoteSize,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -35,7 +37,7 @@ class HtmlMessage extends StatelessWidget {
|
|||
// miss-matching tags, and this way we actually correctly identify what we want to strip and, well,
|
||||
// strip it.
|
||||
final renderHtml = html.replaceAll(
|
||||
RegExp('<mx-reply>.*<\/mx-reply>',
|
||||
RegExp('<mx-reply>.*</mx-reply>',
|
||||
caseSensitive: false, multiLine: false, dotAll: true),
|
||||
'');
|
||||
|
||||
|
|
|
|||
|
|
@ -205,8 +205,8 @@ class _ImageBubbleState extends State<ImageBubble> {
|
|||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.download_outlined),
|
||||
SizedBox(width: 8),
|
||||
const Icon(Icons.download_outlined),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
filename,
|
||||
overflow: TextOverflow.fade,
|
||||
|
|
@ -217,7 +217,7 @@ class _ImageBubbleState extends State<ImageBubble> {
|
|||
),
|
||||
),
|
||||
if (widget.event.sizeString != null) Text(widget.event.sizeString),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Text((error ?? _error).toString()),
|
||||
],
|
||||
),
|
||||
|
|
@ -249,7 +249,7 @@ class _ImageBubbleState extends State<ImageBubble> {
|
|||
children: <Widget>[
|
||||
if (blurhash != null) blurhash,
|
||||
Center(
|
||||
child: child ?? CircularProgressIndicator.adaptive(strokeWidth: 2),
|
||||
child: child ?? const CircularProgressIndicator.adaptive(strokeWidth: 2),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
@ -412,7 +412,7 @@ class _ImageBubbleState extends State<ImageBubble> {
|
|||
child: Hero(
|
||||
tag: widget.event.eventId,
|
||||
child: AnimatedSwitcher(
|
||||
duration: Duration(milliseconds: 1000),
|
||||
duration: const Duration(milliseconds: 1000),
|
||||
child: Container(
|
||||
key: ValueKey(key),
|
||||
constraints: widget.maxSize
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class MapBubble extends StatelessWidget {
|
|||
markers: [
|
||||
Marker(
|
||||
point: LatLng(latitude, longitude),
|
||||
builder: (context) => Icon(
|
||||
builder: (context) => const Icon(
|
||||
Icons.location_pin,
|
||||
color: Colors.red,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@ class Message extends StatelessWidget {
|
|||
this.scrollToEventId,
|
||||
@required this.unfold,
|
||||
this.selected,
|
||||
this.timeline});
|
||||
this.timeline,
|
||||
Key key})
|
||||
: super(key: key);
|
||||
|
||||
/// Indicates wheither the user may use a mouse instead
|
||||
/// of touchscreen.
|
||||
|
|
@ -99,8 +101,8 @@ class Message extends StatelessWidget {
|
|||
),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 6, horizontal: 10),
|
||||
constraints:
|
||||
BoxConstraints(maxWidth: FluffyThemes.columnWidth * 1.5),
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: FluffyThemes.columnWidth * 1.5),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Column(
|
||||
|
|
@ -134,7 +136,8 @@ class Message extends StatelessWidget {
|
|||
},
|
||||
child: AbsorbPointer(
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 4.0),
|
||||
margin: const EdgeInsets.symmetric(
|
||||
vertical: 4.0),
|
||||
child: ReplyContent(replyEvent,
|
||||
lightText: ownMessage,
|
||||
timeline: timeline),
|
||||
|
|
@ -147,7 +150,7 @@ class Message extends StatelessWidget {
|
|||
displayEvent,
|
||||
textColor: textColor,
|
||||
),
|
||||
SizedBox(height: 3),
|
||||
const SizedBox(height: 3),
|
||||
Opacity(
|
||||
opacity: 0,
|
||||
child: _MetaRow(
|
||||
|
|
@ -181,7 +184,7 @@ class Message extends StatelessWidget {
|
|||
),
|
||||
];
|
||||
final avatarOrSizedBox = sameSender
|
||||
? SizedBox(width: Avatar.defaultSize)
|
||||
? const SizedBox(width: Avatar.defaultSize)
|
||||
: Avatar(
|
||||
event.sender.avatarUrl,
|
||||
event.sender.calcDisplayname(),
|
||||
|
|
@ -224,10 +227,11 @@ class Message extends StatelessWidget {
|
|||
color: selected
|
||||
? Theme.of(context).primaryColor.withAlpha(100)
|
||||
: Theme.of(context).primaryColor.withAlpha(0),
|
||||
constraints: BoxConstraints(maxWidth: FluffyThemes.columnWidth * 2.5),
|
||||
constraints:
|
||||
const BoxConstraints(maxWidth: FluffyThemes.columnWidth * 2.5),
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsets.only(left: 8.0, right: 8.0, bottom: 4.0, top: 4.0),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 8.0, right: 8.0, bottom: 4.0, top: 4.0),
|
||||
child: container,
|
||||
),
|
||||
),
|
||||
|
|
@ -267,7 +271,7 @@ class _MetaRow extends StatelessWidget {
|
|||
.withAlpha(200),
|
||||
),
|
||||
),
|
||||
if (showDisplayname) SizedBox(width: 4),
|
||||
if (showDisplayname) const SizedBox(width: 4),
|
||||
Text(
|
||||
event.originServerTs.localizedTime(context),
|
||||
style: TextStyle(
|
||||
|
|
@ -284,7 +288,7 @@ class _MetaRow extends StatelessWidget {
|
|||
color: color,
|
||||
),
|
||||
),
|
||||
if (ownMessage) SizedBox(width: 2),
|
||||
if (ownMessage) const SizedBox(width: 2),
|
||||
if (ownMessage)
|
||||
Icon(
|
||||
displayEvent.statusIcon,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class MessageContent extends StatelessWidget {
|
|||
final Event event;
|
||||
final Color textColor;
|
||||
|
||||
const MessageContent(this.event, {this.textColor});
|
||||
const MessageContent(this.event, {Key key,this.textColor}) : super(key: key);
|
||||
|
||||
void _verifyOrRequestKey(BuildContext context) async {
|
||||
if (event.content['can_request_session'] != true) {
|
||||
|
|
@ -50,7 +50,7 @@ class MessageContent extends StatelessWidget {
|
|||
if (await client.encryption.keyManager.isCached()) {
|
||||
break;
|
||||
}
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
}
|
||||
final timeline = await event.room.getTimeline();
|
||||
timeline.requestKeys();
|
||||
|
|
@ -121,7 +121,7 @@ class MessageContent extends StatelessWidget {
|
|||
fit: BoxFit.cover,
|
||||
tapToView: false,
|
||||
),
|
||||
Icon(Icons.play_circle_outline,
|
||||
const Icon(Icons.play_circle_outline,
|
||||
size: 200, color: Colors.grey),
|
||||
],
|
||||
),
|
||||
|
|
@ -169,7 +169,7 @@ class MessageContent extends StatelessWidget {
|
|||
onPrimary: Theme.of(context).textTheme.bodyText1.color,
|
||||
),
|
||||
onPressed: () => _verifyOrRequestKey(context),
|
||||
icon: Icon(Icons.lock_outline),
|
||||
icon: const Icon(Icons.lock_outline),
|
||||
label: Text(L10n.of(context).encrypted),
|
||||
);
|
||||
case MessageTypes.Location:
|
||||
|
|
@ -194,7 +194,7 @@ class MessageContent extends StatelessWidget {
|
|||
latitude: latlong.first,
|
||||
longitude: latlong.last,
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
const SizedBox(height: 6),
|
||||
OutlinedButton.icon(
|
||||
icon: Icon(Icons.location_on_outlined, color: textColor),
|
||||
onPressed:
|
||||
|
|
@ -219,7 +219,7 @@ class MessageContent extends StatelessWidget {
|
|||
onPrimary: Theme.of(context).textTheme.bodyText1.color,
|
||||
),
|
||||
onPressed: () => launch(event.body),
|
||||
icon: Icon(Icons.phone_outlined, color: Colors.green),
|
||||
icon: const Icon(Icons.phone_outlined, color: Colors.green),
|
||||
label: Text(L10n.of(context).videoCall),
|
||||
);
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ class MessageContent extends StatelessWidget {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.delete_forever_outlined, color: textColor),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
event.getLocalizedBody(MatrixLocals(L10n.of(context)),
|
||||
hideReply: true),
|
||||
|
|
|
|||
|
|
@ -14,42 +14,40 @@ class MessageDownloadContent extends StatelessWidget {
|
|||
final String filename = event.content.containsKey('filename')
|
||||
? event.content['filename']
|
||||
: event.body;
|
||||
return Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Theme.of(context).scaffoldBackgroundColor,
|
||||
onPrimary: Theme.of(context).textTheme.bodyText1.color,
|
||||
),
|
||||
onPressed: () => event.saveFile(context),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.download_outlined),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
filename,
|
||||
overflow: TextOverflow.fade,
|
||||
softWrap: false,
|
||||
maxLines: 1,
|
||||
),
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Theme.of(context).scaffoldBackgroundColor,
|
||||
onPrimary: Theme.of(context).textTheme.bodyText1.color,
|
||||
),
|
||||
onPressed: () => event.saveFile(context),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.download_outlined),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
filename,
|
||||
overflow: TextOverflow.fade,
|
||||
softWrap: false,
|
||||
maxLines: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (event.sizeString != null)
|
||||
Text(
|
||||
event.sizeString,
|
||||
style: TextStyle(
|
||||
color: textColor,
|
||||
),
|
||||
),
|
||||
if (event.sizeString != null)
|
||||
Text(
|
||||
event.sizeString,
|
||||
style: TextStyle(
|
||||
color: textColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ class MessageReactions extends StatelessWidget {
|
|||
final Event event;
|
||||
final Timeline timeline;
|
||||
|
||||
const MessageReactions(this.event, this.timeline);
|
||||
const MessageReactions(this.event, this.timeline, {Key key})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class ReplyContent extends StatelessWidget {
|
|||
height: fontSize * 2 + 6,
|
||||
color: lightText ? Colors.white : Theme.of(context).primaryColor,
|
||||
),
|
||||
SizedBox(width: 6),
|
||||
const SizedBox(width: 6),
|
||||
Flexible(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import '../../config/app_config.dart';
|
|||
class StateMessage extends StatelessWidget {
|
||||
final Event event;
|
||||
final void Function(String) unfold;
|
||||
const StateMessage(this.event, {@required this.unfold});
|
||||
const StateMessage(this.event, {@required this.unfold, Key key})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -52,7 +53,7 @@ class StateMessage extends StatelessWidget {
|
|||
if (counter != 0)
|
||||
Text(
|
||||
L10n.of(context).moreEvents(counter),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ class VerificationRequestContent extends StatelessWidget {
|
|||
final Event event;
|
||||
final Timeline timeline;
|
||||
|
||||
const VerificationRequestContent({this.event, this.timeline});
|
||||
const VerificationRequestContent({this.event, this.timeline, Key key})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -22,13 +23,13 @@ class VerificationRequestContent extends StatelessWidget {
|
|||
final started = start.isNotEmpty;
|
||||
final canceled = cancel.isNotEmpty;
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8.0,
|
||||
vertical: 4.0,
|
||||
),
|
||||
child: Center(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Theme.of(context).dividerColor,
|
||||
|
|
@ -44,7 +45,7 @@ class VerificationRequestContent extends StatelessWidget {
|
|||
color: canceled
|
||||
? Colors.red
|
||||
: (fullyDone ? Colors.green : Colors.grey)),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Text(canceled
|
||||
? 'Error ${cancel.first.content.tryGet<String>('code')}: ${cancel.first.content.tryGet<String>('reason')}'
|
||||
: (fullyDone
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class FluffyBanner extends StatelessWidget {
|
||||
const FluffyBanner({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Image.asset(Theme.of(context).brightness == Brightness.dark
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class InputBar extends StatelessWidget {
|
|||
final ValueChanged<String> onChanged;
|
||||
final bool autofocus;
|
||||
|
||||
InputBar({
|
||||
const InputBar({
|
||||
this.room,
|
||||
this.minLines,
|
||||
this.maxLines,
|
||||
|
|
@ -36,7 +36,8 @@ class InputBar extends StatelessWidget {
|
|||
this.onChanged,
|
||||
this.autofocus,
|
||||
this.textInputAction,
|
||||
});
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
List<Map<String, String>> getSuggestions(String text) {
|
||||
if (controller.selection.baseOffset != controller.selection.extentOffset ||
|
||||
|
|
@ -220,7 +221,7 @@ class InputBar extends StatelessWidget {
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('/' + command, style: TextStyle(fontFamily: 'monospace')),
|
||||
Text('/' + command, style: const TextStyle(fontFamily: 'monospace')),
|
||||
Text(_commandHint(L10n.of(context), command),
|
||||
style: Theme.of(context).textTheme.caption),
|
||||
],
|
||||
|
|
@ -246,7 +247,7 @@ class InputBar extends StatelessWidget {
|
|||
width: size,
|
||||
height: size,
|
||||
),
|
||||
SizedBox(width: 6),
|
||||
const SizedBox(width: 6),
|
||||
Text(suggestion['name']),
|
||||
Expanded(
|
||||
child: Align(
|
||||
|
|
@ -281,7 +282,7 @@ class InputBar extends StatelessWidget {
|
|||
size: size,
|
||||
client: client,
|
||||
),
|
||||
SizedBox(width: 6),
|
||||
const SizedBox(width: 6),
|
||||
Text(suggestion['displayname'] ?? suggestion['mxid']),
|
||||
],
|
||||
),
|
||||
|
|
@ -395,7 +396,7 @@ class InputBar extends StatelessWidget {
|
|||
hideOnEmpty: true,
|
||||
hideOnLoading: true,
|
||||
keepSuggestionsOnSuggestionSelected: true,
|
||||
debounceDuration: Duration(
|
||||
debounceDuration: const Duration(
|
||||
milliseconds:
|
||||
50), // show suggestions after 50ms idle time (default is 300)
|
||||
textFieldConfiguration: TextFieldConfiguration(
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import 'package:fluffychat/widgets/matrix.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoadingView extends StatelessWidget {
|
||||
const LoadingView({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (Matrix.of(context)
|
||||
|
|
@ -23,6 +25,6 @@ class LoadingView extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
return EmptyPage(loading: true);
|
||||
return const EmptyPage(loading: true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class MaxWidthBody extends StatelessWidget {
|
|||
);
|
||||
return withScrolling
|
||||
? SingleChildScrollView(
|
||||
physics: ScrollPhysics(),
|
||||
physics: const ScrollPhysics(),
|
||||
child: Padding(
|
||||
padding: padding,
|
||||
child: child,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class OnePageCard extends StatelessWidget {
|
|||
Matrix.of(context).client.isLogged()
|
||||
? child
|
||||
: Container(
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/login_wallpaper.jpg'),
|
||||
fit: BoxFit.cover,
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ class SideViewLayout extends StatelessWidget {
|
|||
color: Theme.of(context).dividerColor,
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
duration: const Duration(milliseconds: 300),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(),
|
||||
decoration: const BoxDecoration(),
|
||||
width: hideSideView ? 0 : 360.0,
|
||||
child: hideSideView ? null : sideView,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class TwoColumnLayout extends StatelessWidget {
|
|||
children: [
|
||||
Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(),
|
||||
decoration: const BoxDecoration(),
|
||||
width: 360.0,
|
||||
child: mainView,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -27,14 +27,17 @@ class ChatListItem extends StatelessWidget {
|
|||
final Function onTap;
|
||||
final Function onLongPress;
|
||||
|
||||
const ChatListItem(this.room,
|
||||
{this.activeChat = false,
|
||||
this.selected = false,
|
||||
this.onTap,
|
||||
this.onLongPress,
|
||||
this.onForget});
|
||||
const ChatListItem(
|
||||
this.room, {
|
||||
this.activeChat = false,
|
||||
this.selected = false,
|
||||
this.onTap,
|
||||
this.onLongPress,
|
||||
this.onForget,
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
void clickAction(BuildContext context) async {
|
||||
dynamic clickAction(BuildContext context) async {
|
||||
if (onTap != null) return onTap();
|
||||
if (!activeChat) {
|
||||
if (room.membership == Membership.invite &&
|
||||
|
|
@ -161,13 +164,13 @@ class ChatListItem extends StatelessWidget {
|
|||
: Theme.of(context).secondaryHeaderColor,
|
||||
onLongPress: onLongPress,
|
||||
leading: selected
|
||||
? Container(
|
||||
? SizedBox(
|
||||
width: Avatar.defaultSize,
|
||||
height: Avatar.defaultSize,
|
||||
child: Material(
|
||||
color: Theme.of(context).primaryColor,
|
||||
borderRadius: BorderRadius.circular(Avatar.defaultSize),
|
||||
child: Icon(Icons.check, color: Colors.white),
|
||||
child: const Icon(Icons.check, color: Colors.white),
|
||||
),
|
||||
)
|
||||
: Avatar(room.avatar, room.displayname, onTap: onLongPress),
|
||||
|
|
@ -188,8 +191,8 @@ class ChatListItem extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
if (isMuted)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 4.0),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: 4.0),
|
||||
child: Icon(
|
||||
Icons.notifications_off_outlined,
|
||||
size: 16,
|
||||
|
|
@ -227,15 +230,15 @@ class ChatListItem extends StatelessWidget {
|
|||
room.lastEvent.statusIcon,
|
||||
size: 14,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
const SizedBox(width: 4),
|
||||
},
|
||||
AnimatedContainer(
|
||||
width: typingText.isEmpty ? 0 : 18,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(),
|
||||
duration: Duration(milliseconds: 300),
|
||||
decoration: const BoxDecoration(),
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.bounceInOut,
|
||||
padding: EdgeInsets.only(right: 4),
|
||||
padding: const EdgeInsets.only(right: 4),
|
||||
child: Icon(
|
||||
Icons.edit_outlined,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
|
|
@ -286,11 +289,11 @@ class ChatListItem extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.bounceInOut,
|
||||
padding: EdgeInsets.symmetric(horizontal: 7),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||
height: unreadBubbleSize,
|
||||
width: room.notificationCount == 0 && !unread
|
||||
? 0
|
||||
|
|
@ -307,7 +310,7 @@ class ChatListItem extends StatelessWidget {
|
|||
child: room.notificationCount > 0
|
||||
? Text(
|
||||
room.notificationCount.toString(),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 13,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import '../../pages/user_bottom_sheet.dart';
|
|||
class ParticipantListItem extends StatelessWidget {
|
||||
final User user;
|
||||
|
||||
const ParticipantListItem(this.user);
|
||||
const ParticipantListItem(this.user, {Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -38,8 +38,8 @@ class ParticipantListItem extends StatelessWidget {
|
|||
permissionBatch.isEmpty
|
||||
? Container()
|
||||
: Container(
|
||||
padding: EdgeInsets.all(4),
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
padding: const EdgeInsets.all(4),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).secondaryHeaderColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
|
|
@ -49,8 +49,8 @@ class ParticipantListItem extends StatelessWidget {
|
|||
membershipBatch[user.membership].isEmpty
|
||||
? Container()
|
||||
: Container(
|
||||
padding: EdgeInsets.all(4),
|
||||
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||
padding: const EdgeInsets.all(4),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).secondaryHeaderColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
|
|
|
|||
|
|
@ -69,13 +69,13 @@ class PermissionsListTile extends StatelessWidget {
|
|||
leading: CircleAvatar(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
foregroundColor: Colors.grey,
|
||||
child: Icon(Icons.edit_attributes_outlined),
|
||||
child: const Icon(Icons.edit_attributes_outlined),
|
||||
),
|
||||
title: Text(getLocalizedPowerLevelString(context)),
|
||||
subtitle: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(4),
|
||||
padding: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).secondaryHeaderColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
|
|
@ -84,7 +84,7 @@ class PermissionsListTile extends StatelessWidget {
|
|||
child: Text(permission.toString()),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Text(permission.toLocalizedPowerLevelString(context)),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class UserDeviceListItem extends StatelessWidget {
|
|||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
if (userDevice.lastSeenTs != null)
|
||||
Text(DateTime.fromMillisecondsSinceEpoch(userDevice.lastSeenTs)
|
||||
.localizedTimeShort(context)),
|
||||
|
|
@ -120,9 +120,9 @@ class UserDeviceListItem extends StatelessWidget {
|
|||
children: <Widget>[
|
||||
Text(
|
||||
userDevice.deviceId,
|
||||
style: TextStyle(fontWeight: FontWeight.w300),
|
||||
style: const TextStyle(fontWeight: FontWeight.w300),
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
if (keys != null)
|
||||
Text(
|
||||
keys.blocked
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|||
import 'layouts/one_page_card.dart';
|
||||
|
||||
class LockScreen extends StatefulWidget {
|
||||
const LockScreen({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_LockScreenState createState() => _LockScreenState();
|
||||
}
|
||||
|
|
@ -42,7 +44,7 @@ class _LockScreenState extends State<LockScreen> {
|
|||
gradient: LinearGradient(
|
||||
begin: Alignment.topRight,
|
||||
end: Alignment.bottomLeft,
|
||||
stops: [
|
||||
stops: const [
|
||||
0.1,
|
||||
0.4,
|
||||
0.6,
|
||||
|
|
@ -62,12 +64,12 @@ class _LockScreenState extends State<LockScreen> {
|
|||
controller: _textEditingController,
|
||||
focusNode: _focusNode,
|
||||
pinBoxRadius: AppConfig.borderRadius,
|
||||
pinTextStyle: TextStyle(fontSize: 32),
|
||||
pinTextStyle: const TextStyle(fontSize: 32),
|
||||
hideCharacter: true,
|
||||
hasError: _wrongInput,
|
||||
onDone: (String input) async {
|
||||
if (input ==
|
||||
await FlutterSecureStorage()
|
||||
await const FlutterSecureStorage()
|
||||
.read(key: SettingKeys.appLockKey)) {
|
||||
AppLock.of(context).didUnlock();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import 'package:matrix/matrix.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class LogViewer extends StatefulWidget {
|
||||
const LogViewer({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_LogViewerState createState() => _LogViewerState();
|
||||
}
|
||||
|
|
@ -19,14 +21,14 @@ class _LogViewerState extends State<LogViewer> {
|
|||
backgroundColor: Colors.black,
|
||||
appBar: AppBar(
|
||||
title: Text(logLevel.toString()),
|
||||
leading: BackButton(),
|
||||
leading: const BackButton(),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.zoom_in_outlined),
|
||||
icon: const Icon(Icons.zoom_in_outlined),
|
||||
onPressed: () => setState(() => fontSize++),
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.zoom_out_outlined),
|
||||
icon: const Icon(Icons.zoom_out_outlined),
|
||||
onPressed: () => setState(() => fontSize--),
|
||||
),
|
||||
PopupMenuButton<Level>(
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class Matrix extends StatefulWidget {
|
|||
|
||||
final Map<String, String> queryParameters;
|
||||
|
||||
Matrix({
|
||||
const Matrix({
|
||||
this.child,
|
||||
@required this.router,
|
||||
@required this.context,
|
||||
|
|
@ -209,7 +209,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||
|
||||
set cachedPassword(String p) => _cachedPassword = p;
|
||||
|
||||
void _onUiaRequest(UiaRequest uiaRequest) async {
|
||||
Future _onUiaRequest(UiaRequest uiaRequest) async {
|
||||
try {
|
||||
if (uiaRequest.state != UiaRequestState.waitForUser ||
|
||||
uiaRequest.nextStages.isEmpty) return;
|
||||
|
|
@ -224,7 +224,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||
okLabel: L10n.of(widget.context).ok,
|
||||
cancelLabel: L10n.of(widget.context).cancel,
|
||||
textFields: [
|
||||
DialogTextField(
|
||||
const DialogTextField(
|
||||
minLines: 1,
|
||||
maxLines: 1,
|
||||
obscureText: true,
|
||||
|
|
@ -481,7 +481,9 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||
// Display the app lock
|
||||
if (PlatformInfos.isMobile) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
FlutterSecureStorage().read(key: SettingKeys.appLockKey).then((lock) {
|
||||
const FlutterSecureStorage()
|
||||
.read(key: SettingKeys.appLockKey)
|
||||
.then((lock) {
|
||||
if (lock?.isNotEmpty ?? false) {
|
||||
AppLock.of(widget.context).enable();
|
||||
AppLock.of(widget.context).showLockScreen();
|
||||
|
|
@ -507,11 +509,11 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
|||
context,
|
||||
widget.router,
|
||||
onFcmError: (errorMsg, {Uri link}) => Timer(
|
||||
Duration(seconds: 1),
|
||||
const Duration(seconds: 1),
|
||||
() {
|
||||
final banner = SnackBar(
|
||||
content: Text(errorMsg),
|
||||
duration: Duration(seconds: 30),
|
||||
duration: const Duration(seconds: 30),
|
||||
action: link == null
|
||||
? null
|
||||
: SnackBarAction(
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class ProfileBottomSheet extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Container(
|
||||
child: SizedBox(
|
||||
width: min(
|
||||
MediaQuery.of(context).size.width, FluffyThemes.columnWidth * 1.5),
|
||||
child: Material(
|
||||
|
|
@ -58,7 +58,7 @@ class ProfileBottomSheet extends StatelessWidget {
|
|||
backgroundColor:
|
||||
Theme.of(context).scaffoldBackgroundColor.withOpacity(0.5),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_downward_outlined),
|
||||
icon: const Icon(Icons.arrow_downward_outlined),
|
||||
onPressed: Navigator.of(context, rootNavigator: false).pop,
|
||||
tooltip: L10n.of(context).close,
|
||||
),
|
||||
|
|
@ -79,7 +79,7 @@ class ProfileBottomSheet extends StatelessWidget {
|
|||
child: snapshot.hasError
|
||||
? Text(snapshot.error
|
||||
.toLocalizedString(context))
|
||||
: CircularProgressIndicator.adaptive(
|
||||
: const CircularProgressIndicator.adaptive(
|
||||
strokeWidth: 2),
|
||||
)
|
||||
: ContentBanner(
|
||||
|
|
@ -91,18 +91,18 @@ class ProfileBottomSheet extends StatelessWidget {
|
|||
ListTile(
|
||||
title: Text(profile?.displayName ?? userId.localpart),
|
||||
subtitle: Text(userId),
|
||||
trailing: Icon(Icons.account_box_outlined),
|
||||
trailing: const Icon(Icons.account_box_outlined),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: () => _startDirectChat(context),
|
||||
label: Text(L10n.of(context).newChat),
|
||||
icon: Icon(Icons.send_outlined),
|
||||
icon: const Icon(Icons.send_outlined),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
);
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class UnreadBadgeBackButton extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Center(child: BackButton()),
|
||||
const Center(child: BackButton()),
|
||||
StreamBuilder(
|
||||
stream: Matrix.of(context).client.onSync.stream,
|
||||
builder: (context, _) {
|
||||
|
|
@ -31,8 +31,8 @@ class UnreadBadgeBackButton extends StatelessWidget {
|
|||
? Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(4),
|
||||
margin: EdgeInsets.only(bottom: 4, right: 8),
|
||||
padding: const EdgeInsets.all(4),
|
||||
margin: const EdgeInsets.only(bottom: 4, right: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).primaryColor,
|
||||
borderRadius:
|
||||
|
|
@ -40,7 +40,7 @@ class UnreadBadgeBackButton extends StatelessWidget {
|
|||
),
|
||||
child: Text(
|
||||
'$unreadCount',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.white,
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue