mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 13:51:20 +08:00
request_widgets_test => request_pane_test
This commit is contained in:
@ -12,6 +12,7 @@ class RequestPane extends StatefulHookWidget {
|
|||||||
this.tabIndex,
|
this.tabIndex,
|
||||||
this.onPressedCodeButton,
|
this.onPressedCodeButton,
|
||||||
this.onTapTabBar,
|
this.onTapTabBar,
|
||||||
|
required this.tabLabels,
|
||||||
required this.children,
|
required this.children,
|
||||||
this.showIndicators = const [false, false, false],
|
this.showIndicators = const [false, false, false],
|
||||||
this.showViewCodeButton,
|
this.showViewCodeButton,
|
||||||
@ -22,6 +23,7 @@ class RequestPane extends StatefulHookWidget {
|
|||||||
final int? tabIndex;
|
final int? tabIndex;
|
||||||
final void Function()? onPressedCodeButton;
|
final void Function()? onPressedCodeButton;
|
||||||
final void Function(int)? onTapTabBar;
|
final void Function(int)? onTapTabBar;
|
||||||
|
final List<String> tabLabels;
|
||||||
final List<Widget> children;
|
final List<Widget> children;
|
||||||
final List<bool> showIndicators;
|
final List<bool> showIndicators;
|
||||||
final bool? showViewCodeButton;
|
final bool? showViewCodeButton;
|
||||||
@ -35,7 +37,7 @@ class _RequestPaneState extends State<RequestPane>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final TabController controller = useTabController(
|
final TabController controller = useTabController(
|
||||||
initialLength: 3,
|
initialLength: widget.children.length,
|
||||||
vsync: this,
|
vsync: this,
|
||||||
);
|
);
|
||||||
if (widget.tabIndex != null) {
|
if (widget.tabIndex != null) {
|
||||||
@ -75,27 +77,21 @@ class _RequestPaneState extends State<RequestPane>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: const SizedBox.shrink(),
|
: kVSpacer10,
|
||||||
TabBar(
|
TabBar(
|
||||||
key: Key(widget.selectedId!),
|
key: Key(widget.selectedId!),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
overlayColor: kColorTransparentState,
|
overlayColor: kColorTransparentState,
|
||||||
labelPadding: kPh2,
|
labelPadding: kPh2,
|
||||||
onTap: widget.onTapTabBar,
|
onTap: widget.onTapTabBar,
|
||||||
tabs: [
|
tabs: widget.tabLabels.indexed
|
||||||
TabLabel(
|
.map<Widget>(
|
||||||
text: kLabelURLParams,
|
(e) => TabLabel(
|
||||||
showIndicator: widget.showIndicators[0],
|
text: e.$2,
|
||||||
),
|
showIndicator: widget.showIndicators[e.$1],
|
||||||
TabLabel(
|
),
|
||||||
text: kLabelHeaders,
|
)
|
||||||
showIndicator: widget.showIndicators[1],
|
.toList(),
|
||||||
),
|
|
||||||
TabLabel(
|
|
||||||
text: kLabelBody,
|
|
||||||
showIndicator: widget.showIndicators[2],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
kVSpacer5,
|
kVSpacer5,
|
||||||
Expanded(
|
Expanded(
|
@ -24,7 +24,6 @@ export 'dropdown_content_type.dart';
|
|||||||
export 'dropdown_formdata.dart';
|
export 'dropdown_formdata.dart';
|
||||||
export 'dropdown_http_method.dart';
|
export 'dropdown_http_method.dart';
|
||||||
export 'dropdown_import_format.dart';
|
export 'dropdown_import_format.dart';
|
||||||
export 'dropdown_api_type.dart';
|
|
||||||
export 'editor_json.dart';
|
export 'editor_json.dart';
|
||||||
export 'editor.dart';
|
export 'editor.dart';
|
||||||
export 'error_message.dart';
|
export 'error_message.dart';
|
||||||
@ -40,12 +39,13 @@ export 'markdown.dart';
|
|||||||
export 'menu_item_card.dart';
|
export 'menu_item_card.dart';
|
||||||
export 'menu_sidebar_top.dart';
|
export 'menu_sidebar_top.dart';
|
||||||
export 'overlay_widget.dart';
|
export 'overlay_widget.dart';
|
||||||
|
export 'popup_menu_api_type.dart';
|
||||||
export 'popup_menu_codegen.dart';
|
export 'popup_menu_codegen.dart';
|
||||||
export 'popup_menu_env.dart';
|
export 'popup_menu_env.dart';
|
||||||
export 'popup_menu_history.dart';
|
export 'popup_menu_history.dart';
|
||||||
export 'popup_menu_uri.dart';
|
export 'popup_menu_uri.dart';
|
||||||
export 'previewer.dart';
|
export 'previewer.dart';
|
||||||
export 'request_widgets.dart';
|
export 'request_pane.dart';
|
||||||
export 'response_widgets.dart';
|
export 'response_widgets.dart';
|
||||||
export 'splitview_drawer.dart';
|
export 'splitview_drawer.dart';
|
||||||
export 'splitview_dashboard.dart';
|
export 'splitview_dashboard.dart';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:apidash/widgets/request_widgets.dart';
|
import 'package:apidash/widgets/request_pane.dart';
|
||||||
import '../extensions/widget_tester_extensions.dart';
|
import '../extensions/widget_tester_extensions.dart';
|
||||||
import '../test_consts.dart';
|
import '../test_consts.dart';
|
||||||
|
|
||||||
@ -15,8 +15,9 @@ void main() {
|
|||||||
body: RequestPane(
|
body: RequestPane(
|
||||||
selectedId: '1',
|
selectedId: '1',
|
||||||
codePaneVisible: true,
|
codePaneVisible: true,
|
||||||
children: const [Text('abc'), Text('xyz'), Text('mno')],
|
tabLabels: const ['URL Params', 'Headers', 'Body'],
|
||||||
onPressedCodeButton: () {},
|
onPressedCodeButton: () {},
|
||||||
|
children: const [Text('abc'), Text('xyz'), Text('mno')],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -47,6 +48,7 @@ void main() {
|
|||||||
codePaneVisible: true,
|
codePaneVisible: true,
|
||||||
onPressedCodeButton: () {},
|
onPressedCodeButton: () {},
|
||||||
tabIndex: 1,
|
tabIndex: 1,
|
||||||
|
tabLabels: const ['URL Params', 'Headers', 'Body'],
|
||||||
children: const [Text('abc'), Text('xyz'), Text('mno')],
|
children: const [Text('abc'), Text('xyz'), Text('mno')],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -78,6 +80,7 @@ void main() {
|
|||||||
codePaneVisible: false,
|
codePaneVisible: false,
|
||||||
onPressedCodeButton: () {},
|
onPressedCodeButton: () {},
|
||||||
tabIndex: 2,
|
tabIndex: 2,
|
||||||
|
tabLabels: const ['URL Params', 'Headers', 'Body'],
|
||||||
children: const [Text('abc'), Text('xyz'), Text('mno')],
|
children: const [Text('abc'), Text('xyz'), Text('mno')],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -111,6 +114,7 @@ void main() {
|
|||||||
onTapTabBar: (value) {
|
onTapTabBar: (value) {
|
||||||
computedTabIndex = value;
|
computedTabIndex = value;
|
||||||
},
|
},
|
||||||
|
tabLabels: const ['URL Params', 'Headers', 'Body'],
|
||||||
children: const [Text('abc'), Text('xyz'), Text('mno')],
|
children: const [Text('abc'), Text('xyz'), Text('mno')],
|
||||||
),
|
),
|
||||||
),
|
),
|
Reference in New Issue
Block a user