Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
48 kB
2
Indexable
Never
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:get/get.dart';
import 'package:get/state_manager.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';
import 'package:the_citizen_app/src/components/video_view_component.dart';
import 'package:the_citizen_app/src/config/base.dart';
import 'package:the_citizen_app/src/helpers/global_helper.dart';
import 'package:the_citizen_app/src/helpers/hex_color.dart';
import 'package:the_citizen_app/src/helpers/k_text.dart';
import 'package:the_citizen_app/src/helpers/render_svg.dart';
import 'package:the_citizen_app/src/hive_models/offline_shout.dart';
import 'package:the_citizen_app/src/models/process_shout.dart';
import 'package:the_citizen_app/src/pages/process_shout_page.dart';
import 'package:the_citizen_app/src/widgets/custom_review_widget.dart';
import '../config/app_theme.dart';
import '../helpers/route.dart';
import '../utility/utility.dart';

// ignore: must_be_immutable
class ReportDetailsPage extends StatelessWidget with Base {
  ProcessShout? myReport;
  ReportDetailsPage({this.myReport});

  @override
  Widget build(BuildContext context) {
    final CarouselController _controller = CarouselController();

    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        backgroundColor: AppTheme.backgroundColor,
        iconTheme: IconThemeData(
          color: AppTheme.textColor6,
        ),
        leading: GestureDetector(
            onTap: () {
              shoutC.currentIndex.value = 0;
              shoutC.reportDetailsCurrentIndex.value = 0;
              back();
            },
            child: Icon(Icons.arrow_back)),
        title: Text(
          'Report Details',
          style: TextStyle(
            fontFamily: 'Manrope',
            fontSize: 18.0,
            color: AppTheme.appBarTextColor,
            fontWeight: FontWeight.bold,
          ),
        ),
        actions: [
          ReviewIconWidget(screenCode: '0056', screenTitle: 'Report Details'),
        ],
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: EdgeInsets.only(top: 10, left: 15, right: 15, bottom: 5),
          child: Obx(
            () => Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                Container(
                    child: Column(children: [
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      RichText(
                        text: TextSpan(
                          children: <TextSpan>[
                            TextSpan(
                                text: '${myReport!.categoryName} >',
                                style: TextStyle(
                                    fontWeight: FontWeight.bold, color: AppTheme.textColor, fontSize: 14, fontFamily: 'Manrope Bold')),
                            TextSpan(
                                text: myReport!.subcategoryName,
                                style: TextStyle(color: AppTheme.textColor, fontSize: 14, fontFamily: 'Manrope Regular')),
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 10,
                      ),
                      Container(
                        decoration: BoxDecoration(
                          color: hexToColor('#F6FAFC'),
                          borderRadius: BorderRadius.circular(5),
                          border: Border.all(color: hexToColor('#64788250'), width: 1),
                          boxShadow: [
                            BoxShadow(
                              color: Colors.blueGrey,
                              spreadRadius: 1,
                              blurRadius: 1,
                            ),
                          ],
                        ),
                        child: Column(
                          children: [
                            SizedBox(
                              height: 200,
                              child: myReportsC.files.isNotEmpty
                                  ? Container(
                                      padding: EdgeInsets.all(3),
                                      decoration: BoxDecoration(
                                        borderRadius: BorderRadius.circular(5),
                                      ),
                                      child: CarouselSlider(
                                        carouselController: _controller,
                                        items: myReportsC.files
                                            .map(
                                              (item) => GestureDetector(
                                                onTap: () {
                                                  if (myReport!.evidenceType == "IMAGE") {
                                                    Get.to(
                                                      () => GestureDetector(
                                                        onTap: () => back(),
                                                        child: Container(
                                                          width: Get.width,
                                                          child: PhotoView(
                                                            // minScale: .8,
                                                            imageProvider: MemoryImage(
                                                              Utility.convertImg(item!),
                                                            ),
                                                          ),
                                                          decoration: BoxDecoration(
                                                            color: Colors.white70,
                                                          ),
                                                        ),
                                                      ),
                                                      fullscreenDialog: true,
                                                      opaque: false,
                                                    );
                                                  }
                                                },
                                                child: AspectRatio(
                                                  aspectRatio: 16 / 9,
                                                  child: myReport!.evidenceType == "IMAGE"
                                                      ? ClipRRect(
                                                          borderRadius: BorderRadius.circular(10),
                                                          child: PhotoView(
                                                            imageProvider: MemoryImage(item!),
                                                            backgroundDecoration: BoxDecoration(
                                                              color: Colors.white70,
                                                            ),
                                                          ))
                                                      : myReport!.evidenceType == "VIDEO"
                                                          ? VideoViewComponent(bytes: item!.toList())
                                                          : SizedBox(),
                                                ),
                                              ),
                                            )
                                            .toList(),
                                        options: CarouselOptions(
                                            aspectRatio: 16 / 9,
                                            // pageSnapping: false,
                                            //  height: 180,
                                            autoPlay: false,
                                            viewportFraction: 1.0,
                                            autoPlayCurve: Curves.fastOutSlowIn,
                                            enlargeCenterPage: false,
                                            scrollDirection: Axis.horizontal,
                                            onPageChanged: (index, reason) {
                                              shoutC.reportDetailsCurrentIndex.value = index;
                                            }),
                                      ))
                                  : Container(
                                      padding: EdgeInsets.all(3),
                                      child: ClipRRect(
                                        borderRadius: BorderRadius.circular(5),
                                        child: Image.asset(
                                          'assets/images/no_image.png',
                                          fit: BoxFit.cover,
                                          // width: MediaQuery.of(context).size.width,
                                          width: MediaQuery.of(context).size.width - 20,
                                        ),
                                      ),
                                    ),
                            ),
                            SizedBox(
                              height: 40,
                              width: MediaQuery.of(context).size.width,
                              child: myReportsC.files.length != 0
                                  ? Row(
                                      mainAxisAlignment: MainAxisAlignment.center,
                                      children: [
                                        ListView.builder(
                                          scrollDirection: Axis.horizontal,
                                          shrinkWrap: true,
                                          itemCount: myReportsC.files.length,
                                          itemBuilder: (BuildContext context, int index) {
                                            return Obx(
                                              () => Container(
                                                // padding: EdgeInsets.symmetric(horizontal: 5),
                                                padding: EdgeInsets.only(left: 5, right: 5),
                                                child: CircleAvatar(
                                                  radius: 10,
                                                  backgroundColor: index == shoutC.reportDetailsCurrentIndex.value
                                                      ? hexToColor('#F2BA14')
                                                      : hexToColor('#C8E0EA'),
                                                  child: Text(
                                                    (index + 1).toString(),
                                                    style: TextStyle(
                                                      fontFamily: 'Manrope',
                                                      color: hexToColor('#000000'),
                                                      fontSize: 13,
                                                      fontWeight: FontWeight.w700,
                                                    ),
                                                  ),
                                                ),
                                              ),
                                            );
                                          },
                                        ),
                                      ],
                                    )
                                  : Center(
                                      child: Text(
                                        'No Evidence Available',
                                        style: TextStyle(
                                          fontFamily: 'Manrope',
                                          color: hexToColor('#000000'),
                                          fontSize: 15,
                                          fontWeight: FontWeight.w500,
                                        ),
                                      ),
                                    ),
                            ),
                          ],
                        ),
                      )
                    ],
                  ),
                ])),
                SizedBox(
                  height: 10,
                ),
                Row(
                  children: [
                    KText(
                      text: 'Date',
                      fontSize: 15.0,
                      color: AppTheme.appBarTextColor,
                    ),
                    Spacer(),
                    KText(
                      text: 'Urgency',
                      fontSize: 15.0,
                      color: AppTheme.appBarTextColor,
                    )
                  ],
                ),
                Row(
                  children: [
                    KText(
                      text: formatDate(date: myReport!.reportDate!),
                      fontSize: 14,
                      color: AppTheme.appBarTextColor,
                      bold: true,
                    ),
                    Spacer(),
                    KText(
                      text: myReport!.urgencyLevel,
                      fontSize: 14,
                      color: AppTheme.appBarTextColor,
                      bold: true,
                    )
                  ],
                ),
                Divider(
                  thickness: 1,
                ),
                SizedBox(
                  height: 8,
                ),
                if (myReport!.remarks != null && myReport!.remarks != '')
                  Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      KText(
                        text: 'Remarks:',
                        fontSize: 14,
                        color: AppTheme.appBarTextColor,
                      ),
                      KText(
                        text: myReport!.remarks,
                        fontSize: 14,
                        bold: true,
                        color: AppTheme.appBarTextColor,
                      ),
                      Divider(
                        thickness: 1,
                      ),
                    ],
                  ),
                SizedBox(
                  height: 8,
                ),
                Row(
                  children: [
                    KText(
                      text: 'Status: ',
                      fontSize: 14,
                      color: AppTheme.appBarTextColor,
                    ),
                    KText(
                      text: myReport!.fulfillmentStatus,
                      fontSize: 14,
                      color: AppTheme.appBarTextColor,
                      bold: true,
                    )
                  ],
                ),
                SizedBox(
                  height: 8,
                ),
                Row(children: <Widget>[
                  Expanded(
                      child: Divider(
                    thickness: 1,
                  )),
                  SizedBox(
                    width: 5,
                  ),
                  KText(
                    text: "Responding Party",
                    fontSize: 14,
                    color: AppTheme.appBarTextColor,
                  ),
                  // Text("Responding Party"),
                  SizedBox(
                    width: 5,
                  ),
                  Expanded(
                      child: Divider(
                    thickness: 1,
                  )),
                ]),
                SizedBox(
                  height: 10,
                ),
                if (myReport!.agencyName == null)
                  KText(
                    text:
                        "Your shout has been assigned to the right person. But it has to be validated by an officer. Therefore, it is not shown here yet. However, the person's details will appear here once it is validated.",
                    textAlign: TextAlign.justify,
                    maxLines: 4,
                  ),
                if (myReport!.agencyName != null)
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Expanded(
                        child: Column(
                          mainAxisAlignment: MainAxisAlignment.start,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            GestureDetector(
                              onTap: () async {
                                await myReportsC.personImage(name: myReport!.officerUsername!);
                                await myReportsC.userModal(userInfo: myReport);
                                await teamLocationC.getUserImageFromAPI(username: myReport!.officerUsername!);
                              },
                              child: KText(
                                text: myReport!.officerFullname != null ? myReport!.officerFullname : '',
                                fontSize: 14,
                                bold: true,
                                color: AppTheme.appBarTextColor,
                              ),
                            ),
                            KText(
                              text: myReport!.agencyName != null ? myReport!.agencyName : '',
                              fontSize: 14,
                              color: AppTheme.appBarTextColor,
                              maxLines: 4,
                            ),
                          ],
                        ),
                      ),
                      if (myReport!.officerUsername != null)
                        InkWell(
                          onTap: () {
                            if (socketC.getUser(myReport!.officerUsername!)?.sid != null) {
                              callC.getUserRoom(
                                myReport!.officerUsername!,
                                '${socketC.getUser(myReport!.officerUsername!)?.sid}',
                                '${socketC.getUser(myReport!.officerUsername!)!.name}',
                              );
                            } else {
                              Get.snackbar(
                                'Attention!!',
                                'Uers Offline',
                                colorText: AppTheme.black,
                                backgroundColor: AppTheme.appHomePageColor,
                                snackPosition: SnackPosition.BOTTOM,
                                maxWidth: 190,
                              );
                            }
                          },
                          child: RenderSvg(
                            path: 'call_button',
                            height: 24,
                            width: 24,
                          ),
                        ),
                    ],
                  ),
                SizedBox(
                  height: 8,
                ),
                if (myReportsC.closureFiles.length != 0)
                  Container(
                    decoration: BoxDecoration(
                      color: hexToColor('#F6FAFC'),
                      borderRadius: BorderRadius.circular(5),
                      border: Border.all(color: hexToColor('#64788250'), width: 1),
                      boxShadow: [
                        BoxShadow(
                          color: Colors.grey,
                          spreadRadius: 1,
                          blurRadius: 1,
                        ),
                      ],
                    ),
                    child: Column(
                      children: [
                        SizedBox(
                          height: 200,
                          child: myReportsC.closureFiles.isNotEmpty
                              ? Container(
                                  padding: EdgeInsets.all(3),
                                  decoration: BoxDecoration(
                                    borderRadius: BorderRadius.circular(5),
                                  ),
                                  child: PhotoViewGallery.builder(
                                    itemCount: myReportsC.closureFiles.length,
                                    builder: (BuildContext context, int index) {
                                      return PhotoViewGalleryPageOptions(
                                        imageProvider: MemoryImage(myReportsC.closureFiles[index]!),
                                        // maxScale: PhotoViewComputedScale.covered,
                                        // minScale: PhotoViewComputedScale.covered,
                                        //  tightMode: true,
                                      );
                                    },
                                    scrollPhysics: BouncingScrollPhysics(),
                                    backgroundDecoration: BoxDecoration(
                                        color: Theme.of(context).canvasColor,
                                        // color: Colors.transparent,
                                        borderRadius: BorderRadius.circular(5)),
                                    onPageChanged: (int index) {
                                      shoutC.currentIndex.value = index;
                                    },
                                  ),
                                )
                              : Container(
                                  padding: EdgeInsets.all(3),
                                  child: ClipRRect(
                                    borderRadius: BorderRadius.circular(5),
                                    child: Image.asset(
                                      'assets/images/no_image.png',
                                      fit: BoxFit.cover,
                                      // width: MediaQuery.of(context).size.width,
                                      width: MediaQuery.of(context).size.width - 20,
                                    ),
                                  ),
                                ),
                        ),
                        SizedBox(
                          height: 40,
                          width: MediaQuery.of(context).size.width,
                          child: myReportsC.closureFiles.length != 0
                              ? Row(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  children: [
                                    ListView.builder(
                                      scrollDirection: Axis.horizontal,
                                      shrinkWrap: true,
                                      itemCount: myReportsC.closureFiles.length,
                                      itemBuilder: (BuildContext context, int index) {
                                        return Obx(
                                          () => Container(
                                            // padding: EdgeInsets.symmetric(horizontal: 5),
                                            padding: EdgeInsets.only(left: 5, right: 5),
                                            child: CircleAvatar(
                                              radius: 10,
                                              backgroundColor:
                                                  index == shoutC.currentIndex.value ? hexToColor('#F2BA14') : hexToColor('#C8E0EA'),
                                              child: Text(
                                                (index + 1).toString(),
                                                style: TextStyle(
                                                  fontFamily: 'Manrope',
                                                  color: hexToColor('#000000'),
                                                  fontSize: 13,
                                                  fontWeight: FontWeight.w700,
                                                ),
                                              ),
                                            ),
                                          ),
                                        );
                                      },
                                    ),
                                  ],
                                )
                              : Center(
                                  child: Text(
                                    'No Evidence Available',
                                    style: TextStyle(
                                      fontFamily: 'Manrope',
                                      color: hexToColor('#000000'),
                                      fontSize: 15,
                                      fontWeight: FontWeight.w500,
                                    ),
                                  ),
                                ),
                        ),
                      ],
                    ),
                  ),
                SizedBox(
                  height: 5,
                ),
                if (myReport!.stratedComment != null && myReport!.stratedComment != '')
                  Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      KText(text: 'Starting Remarks'),
                      KText(
                        text: myReport!.stratedComment,
                        bold: true,
                      ),
                    ],
                  ),
                SizedBox(
                  height: 5,
                ),
                if (myReport!.comletedOrDroppedComment != null && myReport!.comletedOrDroppedComment != '')
                  Column(
                    mainAxisAlignment: MainAxisAlignment.start,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      KText(text: 'Finishing Remarks'),
                      KText(
                        text: myReport!.comletedOrDroppedComment,
                        bold: true,
                      ),
                    ],
                  ),
                SizedBox(
                  height: 5,
                ),
                if (myReport!.ratingDone == true && myReport?.rating != null)
                  Row(
                    children: [
                      KText(text: 'Rating:  '),
                      RatingBar.builder(
                        initialRating: myReport!.rating!.toDouble(), // Initial rating value
                        // Minimum rating value
                        direction: Axis.horizontal,
                        allowHalfRating: true,
                        itemCount: 5, // Number of rating stars
                        itemSize: 30,
                        ignoreGestures: true, // Size of each rating star
                        itemBuilder: (context, _) => Icon(
                          Icons.star,
                          color: Colors.amber,
                        ),
                        onRatingUpdate: (rating) {
                          // Handle the rating update
                          print(rating);
                        },
                      )
                      // KText(
                      //   text: myReport!.rating.toString(),
                      //   bold: true,
                      // ),
                    ],
                  ),
                if (myReport!.comletedOrDroppedComment != null)
                  Divider(
                    thickness: 1,
                  ),
              ],
            ),
          ),
        ),
      ),
      bottomNavigationBar: Container(
        height: 55,
        width: double.infinity,
        color: Colors.transparent,
        child: Column(children: [
          myReport!.fulfillmentStatus == 'VERIFIED' || myReport!.fulfillmentStatus == 'STARTED'
              ? Center(
                  child: ElevatedButton(
                    onPressed: () {
                      back();
                      // push(MainPage());
                    },
                    child: KText(
                      text: 'OK',
                      fontSize: 16,
                      bold: true,
                      color: Colors.white,
                    ),
                    style: ElevatedButton.styleFrom(
                        backgroundColor: hexToColor('#78909C'),
                        fixedSize: Size(110, 40),
                        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0))),
                  ),
                )
              : Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    if (myReport!.fulfillmentStatus == 'UNASSIGNED' || myReport!.fulfillmentStatus == 'ASSIGNED')
                      ElevatedButton(
                        onPressed: () async {
                          Global.confirmDialog(onConfirmed: () async {
                            myReportsC.reportList.removeWhere((element) => element!.id == myReport!.id);
                            await myReportsC.shoutIncidentDeletePost(myReport!.id!);
                          });
                        },
                        child: KText(
                          text: 'Delete',
                          fontSize: 16,
                          bold: true,
                          color: Colors.white,
                        ),
                        style: ElevatedButton.styleFrom(
                            backgroundColor: hexToColor('#EF4A37'),
                            fixedSize: Size(110, 40),
                            shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0))),
                      ),
                    SizedBox(
                      width: 10,
                    ),
                    if ((myReport!.fulfillmentStatus == 'COMPLETED' || myReport!.fulfillmentStatus == 'Closed By Shouter') &&
                        myReport!.ratingDone == false)
                      ElevatedButton(
                        onPressed: () {
                          back();
                          // push(RateShoutClosurePage());
                          push(ProcessShoutPage(
                            processShoutInfo: myReport,
                            title: 'rateShout',
                          ));
                        },
                        child: KText(
                          text: 'Rate',
                          fontSize: 16,
                          bold: true,
                          color: Colors.white,
                        ),
                        style: ElevatedButton.styleFrom(
                            backgroundColor: hexToColor('#F2BB3C'),
                            fixedSize: Size(100, 35),
                            shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0))),
                      ),
                    SizedBox(
                      width: 15,
                    ),
                    ElevatedButton(
                      onPressed: () {
                        back();
                        // push(MainPage());
                      },
                      child: KText(
                        text: 'OK',
                        fontSize: 16,
                        bold: true,
                        color: Colors.white,
                      ),
                      style: ElevatedButton.styleFrom(
                          backgroundColor: hexToColor('#78909C'),
                          fixedSize: Size(100, 35),
                          shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0))),
                    ),
                  ],
                ),
        ]),
      ),
    );
  }
}

//offline shout details
class OfflineReportDetailsPage extends StatelessWidget with Base {
  final OfflineShoutModel item;
  OfflineReportDetailsPage({required this.item});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        backgroundColor: AppTheme.backgroundColor,
        iconTheme: IconThemeData(
          color: AppTheme.textColor6,
        ),
        leading: GestureDetector(
            onTap: () {
              back();
            },
            child: Icon(Icons.arrow_back)),
        title: Text(
          'Report Details',
          style: TextStyle(
            fontFamily: 'Manrope',
            fontSize: 18.0,
            color: AppTheme.appBarTextColor,
            fontWeight: FontWeight.bold,
          ),
        ),
        actions: [
          ReviewIconWidget(screenCode: '0056', screenTitle: 'Report Details'),
        ],
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: EdgeInsets.only(top: 10, left: 15, right: 15, bottom: 5),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisAlignment: MainAxisAlignment.start,
            children: [
              Container(
                child: Column(children: [
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      RichText(
                        text: TextSpan(
                          children: <TextSpan>[
                            TextSpan(
                                text: '${item.categoryName} > ',
                                style: TextStyle(
                                    fontWeight: FontWeight.bold, color: AppTheme.textColor, fontSize: 14, fontFamily: 'Manrope Bold')),
                            TextSpan(
                                text: '${item.subcategoryName}',
                                style: TextStyle(color: AppTheme.textColor, fontSize: 14, fontFamily: 'Manrope Regular')),
                          ],
                        ),
                      ),
                      SizedBox(
                        height: 10,
                      ),
                      Container(
                        decoration: BoxDecoration(
                          color: hexToColor('#F6FAFC'),
                          borderRadius: BorderRadius.circular(5),
                          border: Border.all(color: hexToColor('#64788250'), width: 1),
                          boxShadow: [
                            BoxShadow(
                              color: Colors.blueGrey,
                              spreadRadius: 1,
                              blurRadius: 1,
                            ),
                          ],
                        ),
                        child: Column(
                          children: [
                            SizedBox(
                                height: 200,
                                child: item.files!.isEmpty
                                    ? Container(
                                        padding: EdgeInsets.all(3),
                                        child: ClipRRect(
                                          borderRadius: BorderRadius.circular(5),
                                          child: Image.asset(
                                            'assets/images/no_image.png',
                                            fit: BoxFit.cover,
                                            // width: MediaQuery.of(context).size.width,
                                            width: MediaQuery.of(context).size.width - 20,
                                          ),
                                        ),
                                      )
                                    : Container(
                                        padding: EdgeInsets.all(3),
                                        decoration: BoxDecoration(
                                          borderRadius: BorderRadius.circular(5),
                                        ),
                                        child: PageView.builder(
                                          onPageChanged: shoutC.offlineCurrentIndex,
                                          physics: BouncingScrollPhysics(),
                                          scrollDirection: Axis.horizontal,
                                          itemCount: item.files!.length,
                                          itemBuilder: (BuildContext context, int index) {
                                            final img = item.files![index];

                                            return InkWell(
                                              onTap: () {
                                                Get.to(
                                                  () => GestureDetector(
                                                    onTap: () => back(),
                                                    child: Container(
                                                      width: Get.width,
                                                      child: PhotoView(
                                                        minScale: .8,
                                                        imageProvider: MemoryImage(img),
                                                      ),
                                                      decoration: BoxDecoration(
                                                        color: Colors.white70,
                                                      ),
                                                    ),
                                                  ),
                                                  fullscreenDialog: true,
                                                  opaque: false,
                                                );
                                              },
                                              child: AspectRatio(
                                                aspectRatio: 16 / 9,
                                                child: ClipRRect(
                                                  borderRadius: BorderRadius.circular(10),
                                                  child: PhotoView(
                                                    imageProvider: MemoryImage(img),
                                                    backgroundDecoration: BoxDecoration(
                                                      color: Colors.white70,
                                                    ),
                                                  ),
                                                ),
                                              ),
                                            );
                                          },
                                        ))),
                            SizedBox(
                              height: 40,
                              width: Get.width,
                              child: item.files != 0
                                  ? Row(
                                      mainAxisAlignment: MainAxisAlignment.center,
                                      children: [
                                        ListView.builder(
                                          scrollDirection: Axis.horizontal,
                                          shrinkWrap: true,
                                          itemCount: item.files!.length,
                                          itemBuilder: (BuildContext context, int index) {
                                            return Obx(
                                              () => Container(
                                                // padding: EdgeInsets.symmetric(horizontal: 5),
                                                padding: EdgeInsets.only(left: 5, right: 5),
                                                child: CircleAvatar(
                                                  radius: 10,
                                                  backgroundColor: index == shoutC.offlineCurrentIndex.value
                                                      ? hexToColor('#F2BA14')
                                                      : hexToColor('#C8E0EA'),
                                                  child: Text(
                                                    (index + 1).toString(),
                                                    style: TextStyle(
                                                      fontFamily: 'Manrope',
                                                      color: hexToColor('#000000'),
                                                      fontSize: 13,
                                                      fontWeight: FontWeight.w700,
                                                    ),
                                                  ),
                                                ),
                                              ),
                                            );
                                          },
                                        ),
                                      ],
                                    )
                                  : Center(
                                      child: Text(
                                        'No Evidence Available',
                                        style: TextStyle(
                                          fontFamily: 'Manrope',
                                          color: hexToColor('#000000'),
                                          fontSize: 15,
                                          fontWeight: FontWeight.w500,
                                        ),
                                      ),
                                    ),
                            ),
                          ],
                        ),
                      )
                    ],
                  ),
                ]),
              ),
              SizedBox(
                height: 10,
              ),
              Row(
                children: [
                  KText(
                    text: 'Date',
                    fontSize: 15.0,
                    color: AppTheme.appBarTextColor,
                  ),
                  Spacer(),
                  KText(
                    text: 'Urgency',
                    fontSize: 15.0,
                    color: AppTheme.appBarTextColor,
                  )
                ],
              ),
              Row(
                children: [
                  KText(
                    text: '${formatDate(date: item.reportedAt!)}',
                    fontSize: 14,
                    color: AppTheme.appBarTextColor,
                    bold: true,
                  ),
                  Spacer(),
                  KText(
                    text: '${item.urgencyLevel}',
                    fontSize: 14,
                    color: AppTheme.appBarTextColor,
                    bold: true,
                  )
                ],
              ),
              Divider(
                thickness: 1,
              ),
              SizedBox(
                height: 8,
              ),
              if ('${item.remarks}' != '')
                Column(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    KText(
                      text: 'Remarks:',
                      fontSize: 14,
                      color: AppTheme.appBarTextColor,
                    ),
                    KText(
                      text: '${item.remarks}',
                      fontSize: 14,
                      bold: true,
                      color: AppTheme.appBarTextColor,
                    ),
                    Divider(
                      thickness: 1,
                    ),
                  ],
                ),
              SizedBox(
                height: 10,
              ),
              Row(children: <Widget>[
                Expanded(
                    child: Divider(
                  thickness: 1,
                )),
                SizedBox(
                  width: 5,
                ),
                KText(
                  text: "Responding Party",
                  fontSize: 14,
                  color: AppTheme.appBarTextColor,
                ),
                // Text("Responding Party"),
                SizedBox(
                  width: 5,
                ),
                Expanded(
                    child: Divider(
                  thickness: 1,
                )),
              ]),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Expanded(
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.start,
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        KText(
                          text: 'Agency Name',
                          fontSize: 14,
                          color: AppTheme.appBarTextColor,
                        ),
                        SizedBox(
                          height: 5,
                        ),
                        KText(
                          text: '${item.agencyName}',
                          fontSize: 14,
                          color: AppTheme.appBarTextColor,
                          bold: true,
                          maxLines: 4,
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ],
          ),
        ),
      ),
      bottomNavigationBar: Container(
        height: 55,
        width: double.infinity,
        color: Colors.transparent,
        child: Column(children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                onPressed: () async {
                  Global.confirmDialog(onConfirmed: () {
                    shoutC.deleteOfflineShout(item);
                    back();
                  });
                },
                child: KText(
                  text: 'Delete',
                  fontSize: 16,
                  bold: true,
                  color: Colors.white,
                ),
                style: ElevatedButton.styleFrom(
                    backgroundColor: hexToColor('#EF4A37'),
                    fixedSize: Size(110, 40),
                    shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0))),
              ),
              SizedBox(
                width: 15,
              ),
              ElevatedButton(
                onPressed: () {
                  back();
                },
                child: KText(
                  text: 'OK',
                  fontSize: 16,
                  bold: true,
                  color: Colors.white,
                ),
                style: ElevatedButton.styleFrom(
                    backgroundColor: hexToColor('#78909C'),
                    fixedSize: Size(100, 35),
                    shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0))),
              ),
            ],
          ),
        ]),
      ),
    );
  }
}
Leave a Comment