import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';

import '../../core/routes/routes.dart';
import '../../core/styles/app_color.dart';
import 'text_widget.dart';

class ReadPDF extends StatelessWidget {
  const ReadPDF({
    super.key,
    required this.title,
    required this.pdfUrl,
  });
  final String title;
  final String pdfUrl;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColor.plainWhite,
      appBar: AppBar(
        scrolledUnderElevation: 0.0,
        backgroundColor: AppColor.plainWhite,
        elevation: 0,
        centerTitle: true,
        title: TextWidget().text20W700(title, clr: AppColor.charcoalColor),
        leading: Padding(
          padding: EdgeInsets.only(
            left: 16.w,
          ),
          child: GestureDetector(
            onTap: () {
              goRouter.pop();
            },
            child: Padding(
              padding: EdgeInsets.only(left: 8.w),
              child: Icon(
                Icons.arrow_back_rounded,
                color: AppColor.appBarIconColor,
                size: 25.r,
              ),
            ),
          ),
        ),
      ),
      body: SfPdfViewer.network(
        pdfUrl,
      ),
    );
  }
}
