| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- import 'package:get/get.dart';
- /// 流媒体服务数据模型
- class StreamingService {
- final String name;
- final String description;
- final String logoUrl;
- StreamingService({
- required this.name,
- required this.description,
- required this.logoUrl,
- });
- }
- class MedialocationController extends GetxController {
- // VPN连接状态
- final isConnected = false.obs;
- final isConnecting = false.obs;
- // 流媒体服务列表
- final List<StreamingService> streamingServices = [
- StreamingService(
- name: 'Netflix',
- description: 'Nifty Streaming',
- logoUrl: 'assets/images/netflix_logo.png',
- ),
- StreamingService(
- name: 'YouTube',
- description: 'YouTube Streaming',
- logoUrl: 'assets/images/youtube_logo.png',
- ),
- StreamingService(
- name: 'hulu',
- description: 'hulu Streaming',
- logoUrl: 'assets/images/hulu_logo.png',
- ),
- StreamingService(
- name: 'Amazon',
- description: 'Amazon Streaming',
- logoUrl: 'assets/images/amazon_logo.png',
- ),
- ];
- @override
- void onInit() {
- super.onInit();
- }
- @override
- void onReady() {
- super.onReady();
- }
- @override
- void onClose() {
- super.onClose();
- }
- /// 打开流媒体服务
- void openStreamingService(StreamingService service) {
- Get.snackbar(
- 'Opening',
- '${service.name} will open soon',
- );
- }
- /// 连接VPN
- void connect() {
- if (isConnecting.value) return;
-
- isConnecting.value = true;
-
- // 模拟连接过程
- Future.delayed(const Duration(seconds: 2), () {
- isConnecting.value = false;
- isConnected.value = true;
- Get.snackbar(
- 'Success',
- 'Connected successfully',
- );
- });
- }
- /// 断开VPN
- void disconnect() {
- isConnected.value = false;
- isConnecting.value = false;
- }
- }
|