AtmoSphere/lib/services/share_service.dart
2026-01-16 18:22:32 +08:00

45 lines
1.0 KiB
Dart

import 'package:share_plus/share_plus.dart';
class ShareService {
// 分享应用
Future<void> shareApp() async {
const text = '''
Check out AtmoSphere - A beautiful weather app with dynamic wallpapers!
🌤️ Real-time weather information
🎨 Dynamic wallpapers based on weather
📍 Multi-city weather tracking
📅 7-day weather forecast
Download now and experience the weather like never before!
''';
// ignore: deprecated_member_use
await Share.share(text);
}
// 分享天气信息
Future<void> shareWeather({
required String city,
required double temperature,
required String condition,
}) async {
final text =
'''
Current weather in $city:
🌡️ Temperature: ${temperature.round()}°C
☁️ Condition: $condition
Shared from AtmoSphere - Your weather companion!
''';
// ignore: deprecated_member_use
await Share.share(text);
}
// 分享自定义文本
Future<void> shareText(String text) async {
// ignore: deprecated_member_use
await Share.share(text);
}
}