remindly 1.0.1 copy "remindly: ^1.0.1" to clipboard
remindly: ^1.0.1 copied to clipboard

discontinued

A simple Flutter package to schedule notifications for a selected date and time.

example/main.dart

import 'package:flutter/material.dart';
import 'package:remindly/notification_service.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await NotificationService.init();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Notification Scheduler Demo',
      home: NotificationScreen(),
    );
  }
}

class NotificationScreen extends StatefulWidget {
  @override
  State<NotificationScreen> createState() => _NotificationScreenState();
}

class _NotificationScreenState extends State<NotificationScreen> {
  DateTime? selectedDateTime;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Schedule Notification')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(selectedDateTime != null
                ? "Selected: $selectedDateTime"
                : "No Date Selected"),
            SizedBox(height: 20),
            ElevatedButton(
              onPressed: () async {
                final picked = await showDatePicker(
                  context: context,
                  initialDate: DateTime.now().add(Duration(minutes: 1)),
                  firstDate: DateTime.now(),
                  lastDate: DateTime(2100),
                );
                if (picked != null) {
                  final time = await showTimePicker(
                    context: context,
                    initialTime: TimeOfDay.now(),
                  );
                  if (time != null) {
                    setState(() {
                      selectedDateTime = DateTime(
                        picked.year,
                        picked.month,
                        picked.day,
                        time.hour,
                        time.minute,
                      );
                    });
                  }
                }
              },
              child: Text("Pick Date & Time"),
            ),
            ElevatedButton(
              onPressed: selectedDateTime == null
                  ? null
                  : () {
                NotificationService.scheduleNotification(
                  id: 1,
                  title: "Reminder",
                  body: "Your scheduled task is due now!",
                  dateTime: selectedDateTime!,
                );
              },
              child: Text("Schedule Notification"),
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
115
points
4
downloads

Publisher

unverified uploader

Weekly Downloads

A simple Flutter package to schedule notifications for a selected date and time.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

flutter, flutter_local_notifications, timezone

More

Packages that depend on remindly