import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';

import 'package:get/get.dart';
import 'package:customer/theme/app_them_data.dart';
import 'package:customer/utils/dark_theme_provider.dart';
import 'package:provider/provider.dart';

import '../controllers/html_view_screen_controller.dart';

class HtmlViewScreenView extends GetView<HtmlViewScreenController> {
  final String title;
  final String htmlData;

  const HtmlViewScreenView({
    super.key,
    required this.title,
    required this.htmlData,
  });

  @override
  Widget build(BuildContext context) {
    final themeChange = Provider.of<DarkThemeProvider>(context);
    return Scaffold(
      backgroundColor: themeChange.isDarkTheme() ? AppThemData.black : AppThemData.white,
      // appBar: AppBarWithBorder(title: title.toString(), bgColor: themeChange.isDarkTheme() ? AppThemData.black : AppThemData.white),
      body: SingleChildScrollView(
        child: Center(
          child: Padding(
            padding: EdgeInsets.fromLTRB(12, 16, 12, MediaQuery.of(context).padding.bottom + 14),
            child: HtmlWidget(
              htmlData.toString(),
              textStyle: DefaultTextStyle.of(context).style,
              key: const Key('uniqueKey'),
            ),
          ),
        ),
      ),
    );
  }
}
