JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
25 days ago10 views
👨‍💻Programming
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false, // Matches the image's debug ribbon presence but not the main view.
      title: 'Flutter Demo',
      // We will set the color theme to something matching the lavender/light purple of the image.
      theme: ThemeData(
        useMaterial3: true,
        scaffoldBackgroundColor: const Color(0xFFEADDFF), // Matches the lavender background of the image
        colorSchemeSeed: const Color(0xFF6200EE), // Set the seed to something relevant
      ),
      home: const MainScreen(),
      routes: {
        '/profile': (context) =>
            const Scaffold(body: Center(child: Text("Profile Screen"))),
        '/settings': (context) =>
            const Scaffold(body: Center(child: Text("Settings Screen"))),
        '/Help': (context) =>
            const Scaffold(body: Center(child: Text("Help Screen"))),
      },
    );
  }
}

class MainScreen extends StatefulWidget {
  const MainScreen({super.key});

  @override
  State<MainScreen> createState() => _MainScreenState();
}

class _MainScreenState extends State<MainScreen> {
  DateTime _date = DateTime.now();
  TimeOfDay _time = TimeOfDay.now();

  void _showDateDialog() async {
    DateTime? select = await showDatePicker(
      context: context,
      initialDate: _date,
      firstDate: DateTime(2000),
      lastDate: DateTime(2027),
      helpText: "SELECT DATE",
      cancelText: "CANCEL",
      confirmText: "SELECT",
    );

    if (select != null && select != _date) {
      setState(() {
        _date = select;
      });
    }
  }

  void _showTimeDialog() async {
    final TimeOfDay? select = await showTimePicker(
      context: context,
      initialTime: _time,
    );

    if (select != null && select != _time) {
      setState(() {
        _time = select;
      });
    }
  }

  void _showAlert() {
    showDialog(
      context: context,
      builder: (context) {
        return AlertDialog(
          title: const Text("Alert"),
          content: const Text("This is an alert dialog."),
          actions: [
            TextButton(
              onPressed: () => Navigator.pop(context),
              child: const Text("OK"),
            ),
          ],
        );
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // AppBar removed to match the image
      body: Container(
        color: const Color(0xFFEADDFF), // Setting the same background color for the body
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            // Header: Settings (matches image)
            const Padding(
              padding: EdgeInsets.fromLTRB(16.0, 32.0, 16.0, 16.0), // Padding to place it near the top like in the image
              child: Text(
                "Settings",
                style: TextStyle(
                  fontSize: 24, // Matches the font size to look like the image
                  fontWeight: FontWeight.normal, // Matches the image font weight
                  color: Colors.black, // Matching text color
                ),
              ),
            ),
            // Birthday (matches image: correct icon, title, and no trailing date)
            ListTile(
              leading: const Icon(Icons.calendar_today, color: Colors.black), // Standard calendar icon
              title: const Text("Birthday", style: TextStyle(color: Colors.black)),
              onTap: _showDateDialog, // Preserve logic
            ),
            // Alarm (matches image: correct icon, title, and no trailing time)
            ListTile(
              leading: const Icon(Icons.alarm, color: Colors.black), // Matches the alarm icon in the image
              title: const Text("Alarm", style: TextStyle(color: Colors.black)),
              onTap: _showTimeDialog, // Preserve logic
            ),
            // Alert Dialog (new item to match image)
            ListTile(
              leading: const Icon(Icons.arrow_right, color: Colors.black, size: 30,), // Using a standard chevron/arrow for the alert dialog item
              title: const Text("Alert Dialog", style: TextStyle(color: Colors.black)),
              onTap: _showAlert, // Call the alert function
            ),
          ],
        ),
      ),
    );
  }
}

⚠️Content was pasted as plain text and auto-formatted as a code block. Use the Code Block button in the editor for proper formatting.

← Back to timeline