第一次提交
This commit is contained in:
40
lib/routes/root_pages/home.dart
Normal file
40
lib/routes/root_pages/home.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../../providers/api.dart';
|
||||
import '../../api/capatcha.dart';
|
||||
|
||||
class HomePage extends HookConsumerWidget {
|
||||
const HomePage({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final cookies = ref.watch(cookieHeaderProvider);
|
||||
|
||||
final future = useMemoized(() async {
|
||||
final client = ref.read(apiClientProvider);
|
||||
final res = await client.get('');
|
||||
return res.bodyBytes;
|
||||
}, []);
|
||||
final snapshot = useFuture(future);
|
||||
|
||||
return ListView(
|
||||
padding: EdgeInsets.all(16),
|
||||
children:[
|
||||
// if (snapshot.hasData) Text('${utf8.decode(snapshot.data!)}'),
|
||||
const Text('HTTP API Client 状态:'),
|
||||
const Gap(16),
|
||||
Text('Cookies: ${cookies}'),
|
||||
if (snapshot.hasData) ...[
|
||||
const Gap(16),
|
||||
Text('${utf8.decode(snapshot.data!)}')
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
41
lib/routes/root_pages/me.dart
Normal file
41
lib/routes/root_pages/me.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:styled_widget/styled_widget.dart';
|
||||
import 'package:gap/gap.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class MePage extends HookConsumerWidget {
|
||||
const MePage({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return ListView(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset('images/test.png', width: 120, height: 120).clipOval(),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'UnknownMp',
|
||||
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 24),
|
||||
),
|
||||
],
|
||||
).constrained(height: 320, width: double.infinity),
|
||||
const Divider(height: 16),
|
||||
Column(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () => context.push('/settings'),
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.settings),
|
||||
title: const Text('设置'),
|
||||
trailing: const Icon(Icons.arrow_forward),
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user