mirror of
https://github.com/foss42/apidash.git
synced 2025-12-01 18:28:25 +08:00
Add the functionality to import a curl file into the app.
The user can click on the button saying "+ Import" after which, they will be allow to drop a curl file and import the curl command in the app.
This commit is contained in:
@@ -6,12 +6,17 @@ import 'package:apidash/consts.dart';
|
||||
import 'sidebar_save_button.dart';
|
||||
|
||||
class SidebarHeader extends ConsumerWidget {
|
||||
const SidebarHeader({super.key, this.onAddNew});
|
||||
const SidebarHeader({super.key, this.onAddNew, this.onImport});
|
||||
final Function()? onAddNew;
|
||||
final Function()? onImport;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final mobileScaffoldKey = ref.read(mobileScaffoldKeyStateProvider);
|
||||
final elevatedButtonStyle = ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
);
|
||||
|
||||
return Padding(
|
||||
padding: kPe8,
|
||||
child: Row(
|
||||
@@ -20,9 +25,19 @@ class SidebarHeader extends ConsumerWidget {
|
||||
const Spacer(),
|
||||
ElevatedButton(
|
||||
onPressed: onAddNew,
|
||||
style: elevatedButtonStyle,
|
||||
child: const Text(
|
||||
kLabelPlusNew,
|
||||
style: kTextStyleButton,
|
||||
style: kTextStyleButtonSmall,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
ElevatedButton(
|
||||
onPressed: onImport,
|
||||
style: elevatedButtonStyle,
|
||||
child: const Text(
|
||||
kLabelImport,
|
||||
style: kTextStyleButtonSmall,
|
||||
),
|
||||
),
|
||||
context.width <= kMinWindowSize.width
|
||||
|
||||
Reference in New Issue
Block a user