diff --git a/lib/screens/home_page/editor_pane/details_card/request_pane/scripts_code_pane.dart b/lib/screens/home_page/editor_pane/details_card/request_pane/scripts_code_pane.dart index 5ff36cf0..d65f273b 100644 --- a/lib/screens/home_page/editor_pane/details_card/request_pane/scripts_code_pane.dart +++ b/lib/screens/home_page/editor_pane/details_card/request_pane/scripts_code_pane.dart @@ -40,7 +40,7 @@ class _ScriptsCodePaneState extends ConsumerState { ); }); - final tabs = ["Pre-Req", "Post-Res"]; + final tabs = ["Pre Request", "Post Response"]; final content = [ ScriptsEditorPane( controller: preReqCodeController, @@ -50,52 +50,45 @@ class _ScriptsCodePaneState extends ConsumerState { ), ]; - return Row( + return Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - width: 100, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - for (int i = 0; i < tabs.length; i++) - ListTile( - dense: true, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(2), - ), - selectedTileColor: _selectedTabIndex == i - ? Theme.of(context).colorScheme.secondaryFixed - : Theme.of(context).colorScheme.surface, - title: Text( - tabs[i], - style: TextStyle( - fontSize: 12, - color: _selectedTabIndex == i - ? Theme.of(context) - .colorScheme - .onSecondaryFixedVariant - : Theme.of(context).colorScheme.onSurface, - ), - ), - selected: _selectedTabIndex == i, - onTap: () { - setState(() { - _selectedTabIndex = i; - }); - }, - ), - ], + Padding( + padding: const EdgeInsets.all(8.0), + child: DropdownButton( + focusColor: Theme.of(context).colorScheme.surface, + icon: Icon( + Icons.arrow_drop_down_rounded, + size: 22, + ), + borderRadius: BorderRadius.circular(9), + elevation: 4, + style: TextStyle( + color: Theme.of(context).colorScheme.onSurfaceVariant, + fontSize: 12, + ), + underline: Container( + height: 0, + ), + value: _selectedTabIndex, + items: tabs.asMap().entries.map((entry) { + return DropdownMenuItem( + value: entry.key, + child: Text(entry.value), + ); + }).toList(), + onChanged: (int? newValue) { + if (newValue != null) { + setState(() { + _selectedTabIndex = newValue; + }); + } + }, ), ), - const VerticalDivider(width: 1), Expanded( - child: Container( - color: Theme.of(context).colorScheme.surfaceContainerLowest, - child: content[_selectedTabIndex], - ), + child: content[_selectedTabIndex], ), ], ); diff --git a/lib/widgets/scripts_editor_pane.dart b/lib/widgets/scripts_editor_pane.dart index 921bb836..a772d8a1 100644 --- a/lib/widgets/scripts_editor_pane.dart +++ b/lib/widgets/scripts_editor_pane.dart @@ -17,27 +17,33 @@ class _ScriptsEditorPaneState extends ConsumerState { @override Widget build(BuildContext context) { final settings = ref.watch(settingsProvider); - return CodeTheme( - data: CodeThemeData( - styles: settings.isDark ? monokaiTheme : xcodeTheme, + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(9), + color: Theme.of(context).colorScheme.surfaceContainerLowest, ), - child: SingleChildScrollView( - child: CodeField( - smartDashesType: SmartDashesType.enabled, - smartQuotesType: SmartQuotesType.enabled, - background: Theme.of(context).colorScheme.surfaceContainerLowest, - gutterStyle: GutterStyle( - width: 40, // TODO: Fix numbers size - margin: 2, - textAlign: TextAlign.left, - showFoldingHandles: false, - showLineNumbers: false, - ), - cursorColor: Theme.of(context).colorScheme.primary, - controller: widget.controller, - textStyle: TextStyle( - fontSize: 12, - fontFamily: 'monospace', + child: CodeTheme( + data: CodeThemeData( + styles: settings.isDark ? monokaiTheme : xcodeTheme, + ), + child: SingleChildScrollView( + child: CodeField( + smartDashesType: SmartDashesType.enabled, + smartQuotesType: SmartQuotesType.enabled, + background: Theme.of(context).colorScheme.surfaceContainerLowest, + gutterStyle: GutterStyle( + width: 40, // TODO: Fix numbers size + margin: 2, + textAlign: TextAlign.left, + showFoldingHandles: false, + showLineNumbers: false, + ), + cursorColor: Theme.of(context).colorScheme.primary, + controller: widget.controller, + textStyle: TextStyle( + fontSize: 12, + fontFamily: 'monospace', + ), ), ), ),