Build and Release FLUX (Multi-Platform) / build-web (push) Successful in 1m59s
Build and Release FLUX (Multi-Platform) / build-linux (push) Successful in 1m24s
Build and Release FLUX (Multi-Platform) / build-windows (push) Successful in 9m47s
Build and Release FLUX (Multi-Platform) / build-macos (push) Failing after 11m15s
100 lines
2.7 KiB
Dart
100 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flux/core/utils/update_prompt_helper.dart';
|
|
import 'package:flux/core/utils/version_check_service.dart';
|
|
|
|
class AppVersionLabel extends StatefulWidget {
|
|
final bool isCollapsed;
|
|
final bool showIcon;
|
|
|
|
const AppVersionLabel({
|
|
super.key,
|
|
this.isCollapsed = false,
|
|
this.showIcon = true,
|
|
});
|
|
|
|
@override
|
|
State<AppVersionLabel> createState() => _AppVersionLabelState();
|
|
}
|
|
|
|
class _AppVersionLabelState extends State<AppVersionLabel> {
|
|
String _version = "";
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_loadVersion();
|
|
}
|
|
|
|
Future<void> _loadVersion() async {
|
|
final v = await VersionCheckService.getShortVersionString();
|
|
if (mounted) {
|
|
setState(() {
|
|
_version = v;
|
|
});
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (_version.isEmpty) return const SizedBox.shrink();
|
|
|
|
final theme = Theme.of(context);
|
|
final textMuted = theme.colorScheme.onSurface.withValues(alpha: 0.5);
|
|
|
|
if (widget.isCollapsed) {
|
|
return Tooltip(
|
|
message: "Flux $_version\nClicca per verificare aggiornamenti",
|
|
child: InkWell(
|
|
borderRadius: BorderRadius.circular(8),
|
|
onTap: () => UpdatePromptHelper.showManualUpdateCheck(context),
|
|
child: Container(
|
|
height: 36,
|
|
width: 36,
|
|
alignment: Alignment.center,
|
|
child: Icon(
|
|
Icons.info_outline,
|
|
size: 16,
|
|
color: textMuted,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
return Tooltip(
|
|
message: "Clicca per verificare se ci sono aggiornamenti",
|
|
child: InkWell(
|
|
borderRadius: BorderRadius.circular(6),
|
|
onTap: () => UpdatePromptHelper.showManualUpdateCheck(context),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 6.0),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
if (widget.showIcon) ...[
|
|
Icon(
|
|
Icons.info_outline,
|
|
size: 13,
|
|
color: textMuted,
|
|
),
|
|
const SizedBox(width: 6),
|
|
],
|
|
Text(
|
|
"Flux $_version",
|
|
style: TextStyle(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w500,
|
|
color: textMuted,
|
|
decoration: TextDecoration.underline,
|
|
decorationColor: textMuted.withValues(alpha: 0.4),
|
|
decorationStyle: TextDecorationStyle.dotted,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|