import 'package:flutter/material.dart';
import 'package:auto_route/auto_route.dart';
import 'package:plugin_basic/modules/global_web_page.dart';
import 'package:plugin_basic/provider/user_config/user_config_service.dart';
import 'package:router/componentRouter/component_service_manager.dart';

@RoutePage()
class MePage extends StatelessWidget {
  const MePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Me")),
      body:Center(
        child: Column(
          children: [
            ElevatedButton(
              onPressed: () {
                UserConfigService.getInstance().setUserInfo("李四");
              },
              child: const Text('跨页面修改用户信息'),
            ),
            ElevatedButton(
              onPressed: () {
               ComponentServiceManager().profileService.startEditProfilePage(context: context);
              },
              child: const Text('Go to Edit Profile Page'),
            ),
            ElevatedButton(
              onPressed: () {
               GlobalWebPage.startInstance(context: context, title: "baidu", url: "https://www.baidu.com");
              },
              child: const Text('Go to Global Web Page'),
            ),
          ],
        ),
      ),
    );
  }
}
