Signing, Installer, New Workflows
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
import '../providers/price_provider.dart';
|
||||
import '../providers/update_provider.dart';
|
||||
import '../services/window_service.dart';
|
||||
import '../widgets/price_chart.dart';
|
||||
import '../widgets/alerts_panel.dart';
|
||||
import '../widgets/vendor_table.dart';
|
||||
@@ -19,13 +21,39 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// Initialize update provider
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// Initialize providers and window service
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
// Initialize window service with context
|
||||
await WindowService().initialize(context: context);
|
||||
|
||||
context.read<UpdateProvider>().initialize();
|
||||
context.read<UpdateProvider>().startPeriodicChecks();
|
||||
|
||||
// Listen to provider changes to update system tray
|
||||
_setupProviderListeners();
|
||||
});
|
||||
}
|
||||
|
||||
void _setupProviderListeners() {
|
||||
// Listen to price provider for connection status
|
||||
context.read<PriceProvider>().addListener(_updateTrayStatus);
|
||||
|
||||
// Listen to update provider for update notifications
|
||||
context.read<UpdateProvider>().addListener(_updateTrayMenu);
|
||||
}
|
||||
|
||||
void _updateTrayStatus() {
|
||||
final priceProvider = context.read<PriceProvider>();
|
||||
WindowService().updateTrayTooltip(
|
||||
'AUEC Tracker - ${priceProvider.connectionStatus}'
|
||||
);
|
||||
}
|
||||
|
||||
void _updateTrayMenu() {
|
||||
final updateProvider = context.read<UpdateProvider>();
|
||||
WindowService().updateTrayMenu(hasUpdate: updateProvider.hasUpdate);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -36,29 +64,32 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
if (!kIsWeb && (Theme.of(context).platform == TargetPlatform.windows ||
|
||||
Theme.of(context).platform == TargetPlatform.macOS ||
|
||||
Theme.of(context).platform == TargetPlatform.linux))
|
||||
Container(
|
||||
height: 40,
|
||||
color: const Color(0xFF1A1F3A),
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(width: 16),
|
||||
const Text(
|
||||
'rmtPocketWatcher',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
GestureDetector(
|
||||
onPanStart: (details) => windowManager.startDragging(),
|
||||
onDoubleTap: () => WindowService().maximizeWindow(),
|
||||
child: Container(
|
||||
height: 40,
|
||||
color: const Color(0xFF1A1F3A),
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(width: 16),
|
||||
const Text(
|
||||
'rmtPocketWatcher',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
const Text(
|
||||
'Lambda Banking Conglomerate',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF888888),
|
||||
fontSize: 12,
|
||||
const Spacer(),
|
||||
const Text(
|
||||
'Lambda Banking Conglomerate',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF888888),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
const SizedBox(width: 16),
|
||||
// Update check button
|
||||
Consumer<UpdateProvider>(
|
||||
builder: (context, updateProvider, child) {
|
||||
@@ -86,21 +117,38 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
);
|
||||
},
|
||||
),
|
||||
// Minimize button (minimize to tray)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.minimize, color: Colors.white, size: 16),
|
||||
onPressed: () {
|
||||
// Minimize window - implement with window_manager
|
||||
onPressed: () => WindowService().minimizeToTray(),
|
||||
tooltip: 'Minimize to system tray',
|
||||
),
|
||||
// Maximize/Restore button
|
||||
FutureBuilder<bool>(
|
||||
future: windowManager.isMaximized(),
|
||||
builder: (context, snapshot) {
|
||||
bool isMaximized = snapshot.data ?? false;
|
||||
return IconButton(
|
||||
icon: Icon(
|
||||
isMaximized ? Icons.fullscreen_exit : Icons.fullscreen,
|
||||
color: Colors.white,
|
||||
size: 16,
|
||||
),
|
||||
onPressed: () => WindowService().maximizeWindow(),
|
||||
tooltip: isMaximized ? 'Restore window' : 'Maximize window',
|
||||
);
|
||||
},
|
||||
),
|
||||
// Close button (exit app)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close, color: Colors.white, size: 16),
|
||||
onPressed: () {
|
||||
// Close window - implement with window_manager
|
||||
},
|
||||
onPressed: () => WindowService().closeWindow(),
|
||||
tooltip: 'Exit application',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// Main content
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
|
||||
Reference in New Issue
Block a user