Untitled

mail@pastecode.io avatar
unknown
plain_text
6 days ago
18 kB
2
Indexable
Never
import 'package:clean_architecture_tdd_flutter_template/core/res/colours.dart';
import 'package:clean_architecture_tdd_flutter_template/src/find/presentation/widgets/circular_check_box.dart';

import 'package:flutter/material.dart';
import 'package:clean_architecture_tdd_flutter_template/core/res/media_res.dart';

import 'package:flutter_svg/flutter_svg.dart';

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

  @override
  State<ReservationDialog> createState() => _ReservationDialogState();
}

class _ReservationDialogState extends State<ReservationDialog> {
  // double _value = 0;
  // String _status = '0 kW';
  // final Color _statusColor = Colours.blackColour;
  bool? isSelected = false;

  @override
  Widget build(BuildContext context) {
    return Container(
      height: MediaQuery.of(context).size.height * 0.6,
      decoration: const BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.only(
            topLeft: Radius.circular(30),
            topRight: Radius.circular(30),
          )),
      child: SafeArea(
        child: Container(
          padding: const EdgeInsets.symmetric(vertical: 32, horizontal: 24),
          child: Column(
            mainAxisSize: MainAxisSize.max,
            children: [
              const Column(
                children: [
                  Text(
                    'Reservation',
                    style: TextStyle(
                      fontSize: 22,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  SizedBox(
                    height: 10,
                  ),
                  Divider(
                    color: Colours.secondaryColourDisabled,
                  )
                ],
              ),
              Expanded(
                child: SingleChildScrollView(
                  child: Column(
                    children: [
                      const SizedBox(height: 10),
                      const Align(
                        alignment: Alignment.centerLeft,
                        child: Text(
                          'Charger A',
                          style: TextStyle(
                              fontSize: 18, fontWeight: FontWeight.bold),
                        ),
                      ),
                      Table(
                        // border: TableBorder.all(), // Atur border untuk tabel
                        children: [
                          TableRow(
                            children: [
                              TableCell(
                                child: Container(
                                  padding: const EdgeInsets.all(8.0),
                                  child: Row(
                                    children: [
                                      SvgPicture.asset(MediaRes.css2Icon),
                                      const SizedBox(
                                        width: 10,
                                      ),
                                      const Text('CCS-2'),
                                    ],
                                  ),
                                ),
                              ),
                              TableCell(
                                child: Container(
                                  width: 60,
                                  height: 30,
                                  decoration: BoxDecoration(
                                    color: Colours
                                        .redColour, // Warna latar belakang
                                    borderRadius: BorderRadius.circular(
                                        20), // Membuat sudut menjadi melengkung
                                  ),
                                  child: const Center(
                                    child: Text(
                                      'Unavailable',
                                      style: TextStyle(
                                        color: Colors.white, // Warna tulisan
                                        fontSize: 15,
                                        fontWeight: FontWeight.bold,
                                      ),
                                    ),
                                  ),
                                ),
                              ),
                              const TableCell(
                                child: CircularCheckbox(),
                              ),
                            ],
                          ),
                          TableRow(
                            children: [
                              TableCell(
                                child: Container(
                                  padding: const EdgeInsets.all(8.0),
                                  child: Row(
                                    children: [
                                      SvgPicture.asset(MediaRes.css1Icon),
                                      const SizedBox(
                                        width: 10,
                                      ),
                                      const Text('CCS-1'),
                                    ],
                                  ),
                                ),
                              ),
                              TableCell(
                                child: Container(
                                  width: 60,
                                  height: 30,
                                  decoration: BoxDecoration(
                                    color: Colours.secondaryColour,
                                    borderRadius: BorderRadius.circular(
                                        20), // Membuat sudut menjadi melengkung
                                  ),
                                  child: const Center(
                                    child: Text(
                                      'Available',
                                      style: TextStyle(
                                        color: Colors.white, // Warna tulisan
                                        fontSize: 15,
                                        fontWeight: FontWeight.bold,
                                      ),
                                    ),
                                  ),
                                ),
                              ),
                              const TableCell(
                                child: CircularCheckbox(),
                              ),
                            ],
                          ),
                          TableRow(
                            children: [
                              TableCell(
                                child: Container(
                                  padding: const EdgeInsets.all(8.0),
                                  child: Row(
                                    children: [
                                      SvgPicture.asset(MediaRes.css2Icon),
                                      const SizedBox(
                                        width: 10,
                                      ),
                                      const Text('CCS-2'),
                                    ],
                                  ),
                                ),
                              ),
                              TableCell(
                                child: Container(
                                  width: 60,
                                  height: 30,
                                  decoration: BoxDecoration(
                                    color: Colours.secondaryColour,
                                    borderRadius: BorderRadius.circular(
                                        20), // Membuat sudut menjadi melengkung
                                  ),
                                  child: const Center(
                                    child: Text(
                                      'Available',
                                      style: TextStyle(
                                        color: Colors.white, // Warna tulisan
                                        fontSize: 15,
                                        fontWeight: FontWeight.bold,
                                      ),
                                    ),
                                  ),
                                ),
                              ),
                              const TableCell(
                                child: CircularCheckbox(),
                              ),
                            ],
                          ),
                        ],
                      ),
                      const SizedBox(height: 10),
                      const Align(
                        alignment: Alignment.centerLeft,
                        child: Text(
                          'Charger B',
                          style: TextStyle(
                              fontSize: 18, fontWeight: FontWeight.bold),
                        ),
                      ),
                      Table(
                        // border: TableBorder.all(), // Atur border untuk tabel
                        children: [
                          TableRow(
                            children: [
                              TableCell(
                                child: Container(
                                  padding: const EdgeInsets.all(8.0),
                                  child: Row(
                                    children: [
                                      SvgPicture.asset(MediaRes.type1Icon),
                                      const SizedBox(
                                        width: 10,
                                      ),
                                      const Text('Type-1'),
                                    ],
                                  ),
                                ),
                              ),
                              TableCell(
                                child: Container(
                                  width: 60,
                                  height: 30,
                                  decoration: BoxDecoration(
                                    color: Colours.secondaryColour,
                                    borderRadius: BorderRadius.circular(
                                        20), // Membuat sudut menjadi melengkung
                                  ),
                                  child: const Center(
                                    child: Text(
                                      'Available',
                                      style: TextStyle(
                                        color: Colors.white, // Warna tulisan
                                        fontSize: 15,
                                        fontWeight: FontWeight.bold,
                                      ),
                                    ),
                                  ),
                                ),
                              ),
                              const TableCell(
                                child: CircularCheckbox(),
                              ),
                            ],
                          ),
                          TableRow(
                            children: [
                              TableCell(
                                child: Container(
                                  padding: const EdgeInsets.all(8.0),
                                  child: Row(
                                    children: [
                                      SvgPicture.asset(MediaRes.type2Icon),
                                      const SizedBox(
                                        width: 10,
                                      ),
                                      const Text('Type-2'),
                                    ],
                                  ),
                                ),
                              ),
                              TableCell(
                                child: Container(
                                  width: 60,
                                  height: 30,
                                  decoration: BoxDecoration(
                                    color: Colours.secondaryColour,
                                    borderRadius: BorderRadius.circular(
                                        20), // Membuat sudut menjadi melengkung
                                  ),
                                  child: const Center(
                                    child: Text(
                                      'Available',
                                      style: TextStyle(
                                        color: Colors.white, // Warna tulisan
                                        fontSize: 15,
                                        fontWeight: FontWeight.bold,
                                      ),
                                    ),
                                  ),
                                ),
                              ),
                              const TableCell(
                                child: CircularCheckbox(),
                              ),
                            ],
                          ),
                          TableRow(
                            children: [
                              TableCell(
                                child: Container(
                                  padding: const EdgeInsets.all(8.0),
                                  child: Row(
                                    children: [
                                      SvgPicture.asset(MediaRes.type1Icon),
                                      const SizedBox(
                                        width: 10,
                                      ),
                                      const Text('Type-1'),
                                    ],
                                  ),
                                ),
                              ),
                              TableCell(
                                child: Container(
                                  width: 60,
                                  height: 30,
                                  decoration: BoxDecoration(
                                    color: Colours.secondaryColour,
                                    borderRadius: BorderRadius.circular(
                                        20), // Membuat sudut menjadi melengkung
                                  ),
                                  child: const Center(
                                    child: Text(
                                      'Available',
                                      style: TextStyle(
                                        color: Colors.white, // Warna tulisan
                                        fontSize: 15,
                                        fontWeight: FontWeight.bold,
                                      ),
                                    ),
                                  ),
                                ),
                              ),
                              const TableCell(
                                child: CircularCheckbox(),
                              ),
                            ],
                          ),
                        ],
                      ),
                      Padding(
                        padding: const EdgeInsets.only(top: 15),
                        child: Row(
                          children: [
                            Expanded(
                              child: ElevatedButton(
                                onPressed: () {
                                  Navigator.of(context).pop();
                                },
                                style: ElevatedButton.styleFrom(
                                  backgroundColor: Colours.primaryColour,
                                  shape: RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(5),
                                    side: const BorderSide(
                                        color: Colours.greenColour, width: 1.5),
                                  ),
                                ),
                                child: const Text(
                                  'Cancel',
                                  style: TextStyle(color: Colours.greenColour),
                                ),
                              ),
                            ),
                            const SizedBox(
                              width: 10,
                            ),
                            Expanded(
                              child: ElevatedButton(
                                onPressed: () {
                                  // Delete Account
                                },
                                style: ElevatedButton.styleFrom(
                                  backgroundColor: Colours.greenColour,
                                  shape: RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(5),
                                  ),
                                ),
                                child: const Text(
                                  'Reserve',
                                  style: TextStyle(color: Colors.white),
                                ),
                              ),
                            ),
                          ],
                        ),
                      )
                    ],
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
Leave a Comment