Untitled

mail@pastecode.io avatar
unknown
plain_text
6 days ago
9.3 kB
2
Indexable
Never
import 'package:clean_architecture_tdd_flutter_template/core/res/colours.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';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import '../domain/entities/charger_station.dart';
import '../views/chargerstation_detail_screen.dart';

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

  @override
  State<LocationDialog> createState() => _LocationDialogState();
}

class _LocationDialogState extends State<LocationDialog> {
  bool? isSelected = false;
  final ChargerStation chargerstation = const ChargerStation(
    name: 'Pakubuwono Residence 2nd Floor',
    location: 'Kebayoran Baru, South Jakarta',
    score: '5',
    reviews: '(99 Reviews)',
    powerRate: '50 kW',
    chargingCost: 'Rp 10.000/kWh',
    parkingCost: 'Rp 5.000/hour',
    id: 1,
    info: 'lorem ipsum',
    reviewers: '(99 Reviews)',
    chargers: [],
    latlng: LatLng(37.42796133580664, 122.01),
  );
  @override
  Widget build(BuildContext context) {
    return Container(
      height: MediaQuery.of(context).size.height * 0.35,
      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: 0, horizontal: 24),
          child: Column(
            mainAxisSize: MainAxisSize.max,
            children: [
              Column(
                children: [
                  SizedBox(
                    width: 390,
                    height: 150,
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          // nama location dan button
                          children: [
                            Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              //nama dan location
                              children: [
                                Text(
                                  chargerstation.name,
                                  style: const TextStyle(
                                      fontSize: 18,
                                      fontFamily: 'Poppins',
                                      fontWeight: FontWeight.w800,
                                      color: Colours.blackColour),
                                ),
                                Padding(
                                  padding: const EdgeInsets.only(top: 5.0),
                                  child: Row(
                                    children: [
                                      SvgPicture.asset(
                                        MediaRes.locationIcon,
                                        width: 15,
                                      ),
                                      const SizedBox(
                                        width: 10,
                                      ),
                                      Text(
                                        chargerstation.location,
                                        style: const TextStyle(
                                            fontSize: 14,
                                            fontFamily: 'Poppins',
                                            fontWeight: FontWeight.bold,
                                            color: Colours
                                                .secondaryColourDisabled),
                                      )
                                    ],
                                  ),
                                ),
                              ],
                            ),
                            SvgPicture.asset(MediaRes.shareIcon, width: 40),
                          ],
                        ),
                        const SizedBox(
                          height: 20,
                        ),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text(
                              chargerstation.score,
                              style: const TextStyle(
                                color: Colours.blackColour,
                                fontWeight: FontWeight.w800,
                              ),
                            ),
                            Row(
                              children: [
                                SvgPicture.asset(MediaRes.starIcon),
                                SvgPicture.asset(MediaRes.starIcon),
                                SvgPicture.asset(MediaRes.starIcon),
                                SvgPicture.asset(MediaRes.starIcon),
                                SvgPicture.asset(MediaRes.starIcon),
                              ],
                            ),
                            Text(
                              chargerstation.reviews,
                              style: const TextStyle(
                                color: Colours.secondaryColourDisabled,
                                fontWeight: FontWeight.w600,
                              ),
                            ),
                            const SizedBox(
                              width: 80,
                            ),
                          ],
                        ),
                      ],
                    ),
                  ),
                  // Text(
                  //   'Filter',
                  //   style: TextStyle(
                  //     fontSize: 22,
                  //     fontWeight: FontWeight.bold,
                  //   ),
                  // ),
                  const SizedBox(
                    height: 10,
                  ),
                  const Divider(
                    color: Colours.secondaryColourDisabled,
                  ),
                  const SizedBox(
                    height: 10,
                  ),
                  SvgPicture.asset(MediaRes.contohIcon),
                  const SizedBox(
                    height: 10,
                  ),
                  const Divider(
                    color: Colours.secondaryColourDisabled,
                  ),
                ],
              ),
              Expanded(
                child: Column(
                  children: [
                    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: () {
                                Navigator.pushNamed(
                                    context, ChargerstationDetail.routeName);
                              },
                              style: ElevatedButton.styleFrom(
                                backgroundColor: Colours.greenColour,
                                shape: RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(5),
                                ),
                              ),
                              child: const Text(
                                'View',
                                style: TextStyle(color: Colors.white),
                              ),
                            ),
                          ),
                        ],
                      ),
                    )
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
Leave a Comment