mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 10:49:49 +08:00
feat: add initial dashbot package implementation
- Created a new Dashbot package with core functionalities. - Implemented Dashbot window model and notifier for state management. - Added UI components including Dashbot default page and home page. - Integrated routing for Dashbot with initial routes defined. - Included assets for Dashbot icons and set up pubspec.yaml. - Added tests for Dashbot window notifier to ensure functionality. - Established a basic README and CHANGELOG for the package.
This commit is contained in:
17
packages/dashbot/lib/core/utils/dashbot_icons.dart
Normal file
17
packages/dashbot/lib/core/utils/dashbot_icons.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class DashbotIcons {
|
||||
DashbotIcons._();
|
||||
static String get dashbotIcon1 =>
|
||||
'packages/dashbot/assets/dashbot_icon_1.png';
|
||||
static String get dashbotIcon2 =>
|
||||
'packages/dashbot/assets/dashbot_icon_2.png';
|
||||
|
||||
static Image getDashbotIcon1({double? width, double? height, BoxFit? fit}) {
|
||||
return Image.asset(dashbotIcon1, width: width, height: height, fit: fit);
|
||||
}
|
||||
|
||||
static Image getDashbotIcon2({double? width, double? height, BoxFit? fit}) {
|
||||
return Image.asset(dashbotIcon2, width: width, height: height, fit: fit);
|
||||
}
|
||||
}
|
||||
25
packages/dashbot/lib/core/utils/show_dashbot.dart
Normal file
25
packages/dashbot/lib/core/utils/show_dashbot.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../dashbot_dashboard.dart';
|
||||
import '../providers/dashbot_window_notifier.dart';
|
||||
|
||||
void showDashbotWindow(BuildContext context, WidgetRef ref) {
|
||||
final isDashbotActive = ref.read(dashbotWindowNotifierProvider).isActive;
|
||||
final windowNotifier = ref.read(dashbotWindowNotifierProvider.notifier);
|
||||
if (isDashbotActive) return;
|
||||
final overlay = Overlay.of(context);
|
||||
OverlayEntry? entry;
|
||||
|
||||
entry = OverlayEntry(
|
||||
builder:
|
||||
(context) => DashbotWindow(
|
||||
onClose: () {
|
||||
entry?.remove();
|
||||
windowNotifier.toggleActive();
|
||||
},
|
||||
),
|
||||
);
|
||||
windowNotifier.toggleActive();
|
||||
overlay.insert(entry);
|
||||
}
|
||||
2
packages/dashbot/lib/core/utils/utils.dart
Normal file
2
packages/dashbot/lib/core/utils/utils.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'show_dashbot.dart';
|
||||
export 'dashbot_icons.dart';
|
||||
Reference in New Issue
Block a user