feat: add mobile settings tab with player and content filter options, a new mobile scaffold, and logo asset.

This commit is contained in:
Michael committed 2025-12-20 10:23:16 +01:00
1 parent 4e00cc7dc7
commit 7e836f8ad3
8 files changed
+287 -121

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter/foundation.dart';
class IpService {
static final IpService _instance = IpService._internal();
factory IpService() {
return _instance;
}
IpService._internal();
String? _cachedCountry;
String? _cachedCountryCode;
Future<void> fetchIpDetails() async {
if (_cachedCountry != null) return;
try {
// Using ip-api.com (free tier, HTTP)
final response = await http.get(Uri.parse('http://ip-api.com/json'));
if (response.statusCode == 200) {
final data = json.decode(response.body);
if (data['status'] == 'success') {
_cachedCountry = data['country'];
_cachedCountryCode = data['countryCode'];
debugPrint(
'IpService: Detected country: $_cachedCountry ($_cachedCountryCode)');
}
}
} catch (e) {
debugPrint('IpService: Error fetching IP details: $e');
}
}
String? get country => _cachedCountry;
String? get countryCode => _cachedCountryCode;
}