linter and lint fixes

This commit is contained in:
2024-05-25 21:36:05 +02:00
parent 7e347a70c2
commit 72be45feb4
15 changed files with 256 additions and 158 deletions

View File

@@ -25,62 +25,9 @@ class _DebugRequestsPageState extends State<DebugRequestsPage> {
itemBuilder: (context, listIndex) {
final req = requestsBox.getAt(requestsBox.length - listIndex - 1)!;
if (req.type == 'SUCCESS') {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 2.0),
child: GestureDetector(
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => DebugRequestViewPage(request: req))),
child: ListTile(
title: Row(
children: [
SizedBox(
width: 120,
child: Text(_dateFormat.format(req.timestampStart), style: TextStyle(fontSize: 12)),
),
Expanded(
child: Text(req.name, style: TextStyle(fontWeight: FontWeight.bold)),
),
SizedBox(width: 2),
Text('${req.timestampEnd.difference(req.timestampStart).inMilliseconds}ms', style: TextStyle(fontSize: 12)),
],
),
subtitle: Text(req.type),
),
),
);
return buildItemSuccess(context, req);
} else {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 2.0),
child: GestureDetector(
onTap: () => Navigator.push(context, MaterialPageRoute(builder: (context) => DebugRequestViewPage(request: req))),
child: ListTile(
tileColor: Theme.of(context).colorScheme.errorContainer,
textColor: Theme.of(context).colorScheme.onErrorContainer,
title: Row(
children: [
SizedBox(
width: 120,
child: Text(_dateFormat.format(req.timestampStart), style: TextStyle(fontSize: 12)),
),
Expanded(
child: Text(req.name, style: TextStyle(fontWeight: FontWeight.bold)),
),
SizedBox(width: 2),
Text('${req.timestampEnd.difference(req.timestampStart).inMilliseconds}ms', style: TextStyle(fontSize: 12)),
],
),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(req.type),
Text(
req.error,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
)),
),
);
return buildItemError(context, req);
}
},
);
@@ -88,4 +35,65 @@ class _DebugRequestsPageState extends State<DebugRequestsPage> {
),
);
}
Padding buildItemError(BuildContext context, SCNRequest req) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 2.0),
child: GestureDetector(
onTap: () => Navigator.push(context, MaterialPageRoute<DebugRequestViewPage>(builder: (context) => DebugRequestViewPage(request: req))),
child: ListTile(
tileColor: Theme.of(context).colorScheme.errorContainer,
textColor: Theme.of(context).colorScheme.onErrorContainer,
title: Row(
children: [
SizedBox(
width: 120,
child: Text(_dateFormat.format(req.timestampStart), style: TextStyle(fontSize: 12)),
),
Expanded(
child: Text(req.name, style: TextStyle(fontWeight: FontWeight.bold)),
),
SizedBox(width: 2),
Text('${req.timestampEnd.difference(req.timestampStart).inMilliseconds}ms', style: TextStyle(fontSize: 12)),
],
),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(req.type),
Text(
req.error,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
)),
),
);
}
Padding buildItemSuccess(BuildContext context, SCNRequest req) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 2.0),
child: GestureDetector(
onTap: () => Navigator.push(context, MaterialPageRoute<DebugRequestViewPage>(builder: (context) => DebugRequestViewPage(request: req))),
child: ListTile(
title: Row(
children: [
SizedBox(
width: 120,
child: Text(_dateFormat.format(req.timestampStart), style: TextStyle(fontSize: 12)),
),
Expanded(
child: Text(req.name, style: TextStyle(fontWeight: FontWeight.bold)),
),
SizedBox(width: 2),
Text('${req.timestampEnd.difference(req.timestampStart).inMilliseconds}ms', style: TextStyle(fontSize: 12)),
],
),
subtitle: Text(req.type),
),
),
);
}
}

View File

@@ -48,7 +48,7 @@ class _MessageListPageState extends State<MessageListPage> {
try {
if (_channels == null) {
final channels = await APIClient.getChannelList(acc.auth!, ChannelSelector.allAny);
_channels = Map.fromIterable(channels, key: (e) => e.channelID);
_channels = <String, ChannelWithSubscription>{for (var v in channels) v.channelID: v};
}
final (npt, newItems) = await APIClient.getMessageList(acc.auth!, thisPageToken, _pageSize);
@@ -76,7 +76,7 @@ class _MessageListPageState extends State<MessageListPage> {
message: item,
allChannels: _channels ?? {},
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => MessageViewPage(message: item)));
Navigator.push(context, MaterialPageRoute<MessageViewPage>(builder: (context) => MessageViewPage(message: item)));
},
),
),

View File

@@ -145,7 +145,7 @@ class MessageListItem extends StatelessWidget {
);
}
processContent(String? v) {
String processContent(String? v) {
if (v == null) {
return '';
}
@@ -158,7 +158,7 @@ class MessageListItem extends StatelessWidget {
return lines.sublist(0, min(_lineCount, lines.length)).join("\n").trim();
}
processTitle(String? v) {
String processTitle(String? v) {
if (v == null) {
return '';
}
@@ -174,7 +174,7 @@ class MessageListItem extends StatelessWidget {
return allChannels[message.channelID]?.displayName ?? message.channelInternalName;
}
showChannel(Message message) {
bool showChannel(Message message) {
return message.channelInternalName != 'main';
}
}

View File

@@ -79,7 +79,7 @@ class _SendRootPageState extends State<SendRootPage> {
//...
}
_buildQRCode(BuildContext context, UserAccount acc) {
Widget _buildQRCode(BuildContext context, UserAccount acc) {
if (acc.auth == null) {
return const Placeholder();
}