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