mirror of
https://github.com/foss42/apidash.git
synced 2025-05-31 22:33:59 +08:00
wip: history details pane
This commit is contained in:
@ -10,7 +10,7 @@ class SidebarHistoryCard extends StatelessWidget {
|
||||
required this.id,
|
||||
required this.models,
|
||||
required this.method,
|
||||
this.selectedId,
|
||||
this.isSelected = false,
|
||||
this.requestGroupSize = 1,
|
||||
this.onTap,
|
||||
});
|
||||
@ -18,7 +18,7 @@ class SidebarHistoryCard extends StatelessWidget {
|
||||
final String id;
|
||||
final List<HistoryMetaModel> models;
|
||||
final HTTPVerb method;
|
||||
final String? selectedId;
|
||||
final bool isSelected;
|
||||
final int requestGroupSize;
|
||||
final Function()? onTap;
|
||||
|
||||
@ -29,7 +29,6 @@ class SidebarHistoryCard extends StatelessWidget {
|
||||
Theme.of(context).colorScheme.surfaceContainerHighest.withOpacity(0.5);
|
||||
final model = models.first;
|
||||
final Color surfaceTint = Theme.of(context).colorScheme.primary;
|
||||
bool isSelected = selectedId == getHistoryRequestKey(model);
|
||||
final String name = getHistoryRequestName(model);
|
||||
return Tooltip(
|
||||
message: name,
|
||||
@ -84,9 +83,9 @@ class SidebarHistoryCard extends StatelessWidget {
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
requestGroupSize == 2
|
||||
? requestGroupSize.toString()
|
||||
: "9+",
|
||||
requestGroupSize > 9
|
||||
? "9+"
|
||||
: requestGroupSize.toString(),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelSmall
|
||||
|
@ -20,38 +20,40 @@ class ErrorMessage extends StatelessWidget {
|
||||
return Padding(
|
||||
padding: kPh20v10,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
showIcon
|
||||
? Icon(
|
||||
Icons.warning_rounded,
|
||||
size: 40,
|
||||
color: color,
|
||||
)
|
||||
: const SizedBox(),
|
||||
SelectableText(
|
||||
message ?? 'An error occurred. $kUnexpectedRaiseIssue',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium
|
||||
?.copyWith(color: color),
|
||||
),
|
||||
kVSpacer20,
|
||||
showIssueButton
|
||||
? FilledButton.tonalIcon(
|
||||
onPressed: () {
|
||||
launchUrl(Uri.parse(kGitUrl));
|
||||
},
|
||||
icon: const Icon(Icons.arrow_outward_rounded),
|
||||
label: Text(
|
||||
'Raise Issue',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
showIcon
|
||||
? Icon(
|
||||
Icons.warning_rounded,
|
||||
size: 40,
|
||||
color: color,
|
||||
)
|
||||
: const SizedBox(),
|
||||
SelectableText(
|
||||
message ?? 'An error occurred. $kUnexpectedRaiseIssue',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium
|
||||
?.copyWith(color: color),
|
||||
),
|
||||
kVSpacer20,
|
||||
showIssueButton
|
||||
? FilledButton.tonalIcon(
|
||||
onPressed: () {
|
||||
launchUrl(Uri.parse(kGitUrl));
|
||||
},
|
||||
icon: const Icon(Icons.arrow_outward_rounded),
|
||||
label: Text(
|
||||
'Raise Issue',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -8,16 +8,19 @@ class RawTextField extends StatelessWidget {
|
||||
this.controller,
|
||||
this.hintText,
|
||||
this.style,
|
||||
this.readOnly = false,
|
||||
});
|
||||
|
||||
final void Function(String)? onChanged;
|
||||
final TextEditingController? controller;
|
||||
final String? hintText;
|
||||
final TextStyle? style;
|
||||
final bool readOnly;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextField(
|
||||
readOnly: readOnly,
|
||||
controller: controller,
|
||||
onChanged: onChanged,
|
||||
style: style,
|
||||
|
@ -19,7 +19,7 @@ class HistorySplitView extends StatefulWidget {
|
||||
class HistorySplitViewState extends State<HistorySplitView> {
|
||||
final MultiSplitViewController _controller = MultiSplitViewController(
|
||||
areas: [
|
||||
Area(id: "sidebar", min: 200, size: 220, max: 300),
|
||||
Area(id: "sidebar", min: 200, size: 250, max: 300),
|
||||
Area(id: "main"),
|
||||
],
|
||||
);
|
||||
|
56
lib/widgets/tabbar_request_response.dart
Normal file
56
lib/widgets/tabbar_request_response.dart
Normal file
@ -0,0 +1,56 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:apidash/consts.dart';
|
||||
|
||||
class RequestResponseTabbar extends StatelessWidget {
|
||||
const RequestResponseTabbar({
|
||||
super.key,
|
||||
required this.controller,
|
||||
});
|
||||
|
||||
final TabController controller;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Container(
|
||||
width: kReqResTabWidth,
|
||||
height: kReqResTabHeight,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: kBorderRadius20,
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.outlineVariant,
|
||||
),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: kBorderRadius20,
|
||||
child: TabBar(
|
||||
dividerColor: Colors.transparent,
|
||||
indicatorWeight: 0.0,
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
unselectedLabelColor:
|
||||
Theme.of(context).colorScheme.onSurface.withOpacity(0.4),
|
||||
labelStyle: kTextStyleTab.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
unselectedLabelStyle: kTextStyleTab,
|
||||
splashBorderRadius: kBorderRadius20,
|
||||
indicator: BoxDecoration(
|
||||
borderRadius: kBorderRadius20,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
controller: controller,
|
||||
tabs: const <Widget>[
|
||||
Tab(
|
||||
text: kLabelRequest,
|
||||
),
|
||||
Tab(
|
||||
text: kLabelResponse,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -45,6 +45,7 @@ export 'splitview_dashboard.dart';
|
||||
export 'splitview_equal.dart';
|
||||
export 'splitview_history.dart';
|
||||
export 'suggestions_menu.dart';
|
||||
export 'tabbar_request_response.dart';
|
||||
export 'tables.dart';
|
||||
export 'tabs.dart';
|
||||
export 'texts.dart';
|
||||
|
Reference in New Issue
Block a user