reviewscreen

mail@pastecode.io avatar
unknown
dart
14 days ago
6.9 kB
2
Indexable
Never
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:clean_architecture_tdd_flutter_template/core/common/widgets/app_bar_core.dart';

import 'package:flutter_rating_stars/flutter_rating_stars.dart';

import '../../../../core/res/colours.dart';
import '../../../../core/res/media_res.dart';
import '../domain/entities/user_review_request.dart';

class ReviewScreen extends StatefulWidget {
  const ReviewScreen({super.key});
  static const routeName = '/reviewscreen';
  @override
  State<ReviewScreen> createState() => _ReviewScreenState();
}

class _ReviewScreenState extends State<ReviewScreen> {
  static const UserReview user1 = UserReview(
    name: 'You',
    time: 'January 24, 2024  20:00',
    review:
        'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
  );
  @override
  void dispose() {
    // Clean up the controller when the widget is disposed
    _controller.dispose();
    super.dispose();
  }

  final TextEditingController _controller = TextEditingController();
  double value = 0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Column(
            children: [
              const AppBarCore(
                title: 'Write Review',
                size: 18,
              ),
              const SizedBox(height: 20),
              Row(
                children: [
                  Padding(
                    padding: const EdgeInsets.only(left: 25, right: 25),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: [
                            SizedBox(
                              width: 40,
                              height: 40,
                              child: Image.asset(
                                MediaRes.userImage,
                                fit: BoxFit.cover,
                              ),
                            ),
                            Padding(
                              padding: const EdgeInsets.only(left: 20),
                              child: Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Text(
                                    user1.name,
                                    style: const TextStyle(
                                      color: Colours.blackColour,
                                      fontWeight: FontWeight.w600,
                                      fontSize: 18,
                                    ),
                                  ),
                                  const SizedBox(
                                    width: 270,
                                    child: Text(
                                      'Your review will be shown at the detail of chargestation',
                                      style: TextStyle(
                                        color: Colours.secondaryColourDisabled,
                                        fontWeight: FontWeight.w600,
                                      ),
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ],
                        ),
                      ],
                    ),
                  ),
                ],
              ),
              RatingStars(
                value: value,
                onValueChanged: (v) {
                  setState(() {
                    value = v;
                  });
                },
                starBuilder: (index, color) {
                  return Icon(
                    Icons.star,
                    color: color,
                  );
                },
                starSpacing: 0,
                starCount: 5,
                starSize: 70,
                valueLabelVisibility: false,
                starOffColor: Colours.fadeColour,
                starColor: Colours.starOnColour,
              ),
              Container(
                  width: 400,
                  height: 50,
                  decoration: BoxDecoration(
                    border:
                        Border.all(color: Colours.secondaryColour, width: 2),
                    borderRadius: BorderRadius.circular(20),
                  ),
                  child: Padding(
                    padding: const EdgeInsets.only(left: 25),
                    child: TextField(
                      controller: _controller,
                      decoration: const InputDecoration(
                        enabledBorder: InputBorder.none,
                        focusedBorder: InputBorder.none,
                        hintText: 'Describe your experience (Opsional)',
                        hintStyle: TextStyle(color: Colours.secondaryColour),
                        border: OutlineInputBorder(
                          borderSide: BorderSide(
                            style: BorderStyle.none,
                          ),
                        ),
                      ),
                      maxLines:
                          1, // Ini memungkinkan pengguna untuk menulis beberapa baris teks
                    ),
                  ))
            ],
          ),
          Padding(
            padding: const EdgeInsets.only(bottom: 20),
            child: ElevatedButton(
              style: ButtonStyle(
                backgroundColor: MaterialStateProperty.all<Color>(
                  Colours.tertiaryColour,
                ),
                fixedSize: MaterialStateProperty.all<Size>(
                  const Size(400, 50),
                ),
              ),
              onPressed: () {},
              child: const Text(
                'Post',
                style: TextStyle(color: Colours.primaryColour),
              ),
            ),
            // Container(
            //   height: 50,
            //   width: 400,
            //   color: Colours.blackColour,
            // ),
          ),
        ],
      ),
    );
  }
}
Leave a Comment