import 'package:flutter/material.dart';
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';

import '../../tools/tools.dart';

class MineAboutPage extends StatefulWidget {
  const MineAboutPage({super.key});

  @override
  State<MineAboutPage> createState() => _MineAboutPageState();
}

class _MineAboutPageState extends State<MineAboutPage> {
  String appVersion = "获取中...";

  @override
  void initState() {
    super.initState();
    _loadAppVersion();
  }

  Future<void> _loadAppVersion() async {
    final versionInfo = await getAppVersion();
    setState(() {
      appVersion = versionInfo.fullVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MyAppbar(title: "关于"),
      body: SafeArea(
        child: Column(
          children: [
            SizedBox(height: 80),
            SizedBox(
              width: 1000,
              child: Image.asset(
                "assets/images/app-logo.png",
                width: 70,
                height: 70,
              ),
            ),
            SizedBox(height: 80),
            Container(
              padding: EdgeInsets.symmetric(horizontal: 15, vertical: 5),
              color: Colors.white,
              child: ListItemFactory.createRowSpaceBetweenItem(
                leftText: "当前版本",
                rightText: appVersion,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
