Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
16 kB
1
Indexable
Never
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.categoryName}',
                                style: TextStyle(color: AppTheme.textColor, fontSize: 14, fontFamily: 'Manrope Regular')),
                          ],
                        ),
                      ),
                      RichText(
                        text: TextSpan(
                          children: <TextSpan>[
                            TextSpan(
                                text: '${item.categoryName}',
                                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 Image 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