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