import 'package:chat/configs/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class AuthCreateVerifyPage extends StatefulWidget {
  const AuthCreateVerifyPage({Key? key}) : super(key: key);

  @override
  _AuthCreateVerifyPageState createState() => _AuthCreateVerifyPageState();
}

class _AuthCreateVerifyPageState extends State<AuthCreateVerifyPage> {
  late final List<String> _mnemonicList;
  @override
  void initState() {
    super.initState();
    Get.arguments['language'];
    var m = Get.arguments['mnemonic'] as List<String>;
    m.shuffle();
    _mnemonicList = m;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('校验助记词'),
      ),
      body: _moArea(_mnemonicList),
    );
  }

  Widget _moArea(List<String> mnemonic) {
    return Padding(
      padding: const EdgeInsets.all(16.0),
      child: GridView.builder(
        gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 2,
          childAspectRatio: 4.5 / 1,
          crossAxisSpacing: 8,
          mainAxisSpacing: 8,
        ),
        itemCount: mnemonic.length,
        itemBuilder: (_, i) {
          return Container(
            padding: const EdgeInsets.all(8),
            decoration: BoxDecoration(
              border: Border.all(
                color: AppColors.border,
                width: 1,
              ),
              borderRadius: BorderRadius.circular(8),
            ),
            child: Text(
              '${i + 1}. ${mnemonic[i]}',
              style: const TextStyle(
                fontSize: 16,
              ),
            ),
          );
        },
      ),
    );
  }
}
