/*
 * @Author       : WuWei
 * @LastEditors  : WuWei
 * @Date         : 2022-05-12 09:35:42
 * @LastEditTime : 2023-05-24 15:57:07
 * @Description  : Do not edit
 */
import 'package:app_package/src/view_models/private_mine_store.dart';
import 'package:flutter/material.dart';
import 'package:wisdom_cli/wisdom_cli.dart';

class VersionDetail extends StatelessWidget {
  const VersionDetail({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (_) => PrivateMineStore(context, _),
      child: _PageView(),
      lazy: false,
    );
  }
}

class _PageView extends StatefulWidget {
  _PageView({Key? key}) : super(key: key);
  @override
  _PageViewState createState() => _PageViewState();
}

class _PageViewState extends State<_PageView> {
  late PrivateMineStore _store;
    


  @override
  Widget build(BuildContext context) {
    _store = Provider.of<PrivateMineStore>(context);
    final colorScheme = WTheme.of(context).colorScheme;
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: WAppBar(
        brightness: Brightness.light,
        iconTheme: IconThemeData(
          color: colorScheme.mainTitle,
          size: 19.pt,
        ),
        backgroundColor: Colors.white,
        title: WisText(
          '${_store.version}版本介绍',
          size: 19.pt,
          weight: FontWeight.w600,
          color: colorScheme.mainTitle,
        ),
      ),
      body: WisScrollView(
        onInit: () => _store.getAppInfo(),
        slivers: <Widget>[
          Wisdom.row(
              onTap: () => launch('https://app.huiguanjia.cn'),
              padding: EdgeInsets.symmetric(horizontal: 20.pt),
              children: [
                WisText('官网更新地址：'),
                WisText(
                  'https://app.huiguanjia.cn',
                  color: colorScheme.primary,
                ),
              ]).asSliver(),
          Wisdom.row(
              padding: EdgeInsets.symmetric(horizontal: 20.pt),
              children: [
                WisText(
                  '(如遇检查更新无法进行时，请进入官网进行更新)',
                  size: 12.pt,
                  color: colorScheme.minor,
                )
              ]).asSliver(),
          _buildContentComponent(),
        ],
      ),
    );
  }

  Widget _buildContentComponent() {
    // final colorScheme = WTheme.of(context).colorScheme;
    return SliverToBoxAdapter(
      child: Wisdom.column(
        padding: EdgeInsets.fromLTRB(15.pt, 15.pt, 15.pt, 15.pt),
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          // Container(
          //   child: HtmlWidget(
          //     data: _store.versionDetail ?? '',
          //     style: {
          //       'body': Style(
          //         fontSize: FontSize(16.pt),
          //         color: colorScheme.mainTitle,
          //       )
          //     },
          //   ),
          // ),
        ],
      ),
    );
  }
}
