0.1.2 #1
+34
-26
@@ -60,14 +60,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
}
|
||||
|
||||
Future<void> _initNotifications() async {
|
||||
const androidInit =
|
||||
AndroidInitializationSettings('@mipmap/ic_launcher');
|
||||
const androidInit = AndroidInitializationSettings('@mipmap/ic_launcher');
|
||||
const iosInit = DarwinInitializationSettings();
|
||||
await _notifications.initialize(
|
||||
const InitializationSettings(
|
||||
android: androidInit,
|
||||
iOS: iosInit,
|
||||
),
|
||||
const InitializationSettings(android: androidInit, iOS: iosInit),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -251,16 +247,20 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// --- Location section ---
|
||||
const Text('Location',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const Text(
|
||||
'Location',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _latController,
|
||||
keyboardType:
|
||||
const TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
keyboardType: const TextInputType.numberWithOptions(
|
||||
signed: true,
|
||||
decimal: true,
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Latitude',
|
||||
border: OutlineInputBorder(),
|
||||
@@ -272,8 +272,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _lngController,
|
||||
keyboardType:
|
||||
const TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
keyboardType: const TextInputType.numberWithOptions(
|
||||
signed: true,
|
||||
decimal: true,
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Longitude',
|
||||
border: OutlineInputBorder(),
|
||||
@@ -292,8 +294,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// --- Sunset time section ---
|
||||
const Text('Sunset',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const Text(
|
||||
'Sunset',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
@@ -309,13 +313,14 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
IconButton.filledTonal(
|
||||
icon: _loading
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.cloud_done_outlined),
|
||||
icon:
|
||||
_loading
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.cloud_done_outlined),
|
||||
tooltip: 'Fetch sunset from Open-Meteo',
|
||||
onPressed: _loading ? null : _fetchSunset,
|
||||
),
|
||||
@@ -324,8 +329,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// --- Minutes before ---
|
||||
const Text('Alert Before Sunset',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||
const Text(
|
||||
'Alert Before Sunset',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
@@ -335,8 +342,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
child: TextField(
|
||||
controller: _minutesController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration:
|
||||
const InputDecoration(border: OutlineInputBorder()),
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
onChanged: (v) {
|
||||
final val = int.tryParse(v);
|
||||
if (val != null && val > 0) {
|
||||
@@ -365,4 +373,4 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user