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 ago1 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 _showAlertDialog() {
    showDialog(
      context: context,
      builder: (_)=>AlertDialog (
        title:Text("logout account"),
        content:Text("are you sure?"),
        actions: [
          TextButton(onPressed: (){
            Navigator.pop(context);
          },
           child: Text("yes"),
           ),
           TextButton(onPressed: (){
             Navigator.pop(context);
           }, child: Text("cancel"),
           ),
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Settings")),
      // AppBar removed to match the image
      body: Column(
     
          children: [
            // Header: Settings (matches image)
   
            ListTile(
              leading: Icon(Icons.calendar_today), // Standard calendar icon
              title:Text("Birthday"),
              trailing: Text(_date.toString().split('-')[0]),
              onTap: _showDateDialog, // Preserve logic
            ),
            // Alarm (matches image: correct icon, title, and no trailing time)
            ListTile(
              leading:  Icon(Icons.alarm), // Matches the alarm icon in the image
              title:  Text("alarm"),
              trailing: Text(_time.format(context)),
              onTap: _showTimeDialog, // Preserve logic
            ),
            // Alert Dialog (new item to match image)
            ListTile(
              leading:  Icon(Icons.logout), // Using a standard chevron/arrow for the alert dialog item
              title:  Text("Alert Dialog"),
              onTap: _showAlertDialog, // Call the alert function
            ),
          ],
        ),
      );
    
  }
}
← Back to timeline