mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 18:57:05 +08:00
fix: enhance network log tile display with request name and method styling
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:apidash_design_system/apidash_design_system.dart';
|
||||||
|
import 'package:apidash_core/apidash_core.dart';
|
||||||
import '../consts.dart';
|
import '../consts.dart';
|
||||||
import '../models/terminal/models.dart';
|
import '../models/terminal/models.dart';
|
||||||
|
import '../utils/ui_utils.dart';
|
||||||
import 'expandable_section.dart';
|
import 'expandable_section.dart';
|
||||||
|
|
||||||
class SystemLogTile extends StatelessWidget {
|
class SystemLogTile extends StatelessWidget {
|
||||||
@@ -156,15 +159,18 @@ class _NetworkLogTileState extends State<NetworkLogTile> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final n = widget.entry.network!;
|
final n = widget.entry.network!;
|
||||||
final methodUrl = '${n.method.name.toUpperCase()} ${n.url}';
|
|
||||||
final status = n.responseStatus != null ? '${n.responseStatus}' : null;
|
final status = n.responseStatus != null ? '${n.responseStatus}' : null;
|
||||||
final duration =
|
final duration =
|
||||||
n.duration != null ? '${n.duration!.inMilliseconds} ms' : null;
|
n.duration != null ? '${n.duration!.inMilliseconds} ms' : null;
|
||||||
final title = [
|
final bodyStyle = Theme.of(context).textTheme.bodyMedium;
|
||||||
if (widget.requestName != null && widget.requestName!.isNotEmpty)
|
final methodStyle = kCodeStyle.copyWith(
|
||||||
'[${widget.requestName}]',
|
fontWeight: FontWeight.bold,
|
||||||
methodUrl,
|
color: getAPIColor(
|
||||||
].join(' ');
|
APIType.rest,
|
||||||
|
method: n.method,
|
||||||
|
brightness: Theme.of(context).brightness,
|
||||||
|
),
|
||||||
|
);
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
InkWell(
|
||||||
@@ -183,11 +189,22 @@ class _NetworkLogTileState extends State<NetworkLogTile> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: RichText(
|
||||||
title,
|
text: TextSpan(
|
||||||
|
style: bodyStyle,
|
||||||
|
children: [
|
||||||
|
if (widget.requestName != null &&
|
||||||
|
widget.requestName!.isNotEmpty) ...[
|
||||||
|
TextSpan(text: '[${widget.requestName}] '),
|
||||||
|
],
|
||||||
|
TextSpan(
|
||||||
|
text: n.method.name.toUpperCase(),
|
||||||
|
style: methodStyle),
|
||||||
|
TextSpan(text: ' ${n.url}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: Theme.of(context).textTheme.bodyMedium,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
|
|||||||
Reference in New Issue
Block a user