72 lines
2.2 KiB
Dart
72 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:gitea_client/cubit/repo_event.dart';
|
|
import 'package:gitea_client/cubit/repo_cubit.dart';
|
|
import 'package:gitea_client/model/user.dart';
|
|
import 'package:gitea_client/service/gitea_service.dart';
|
|
import 'package:gitea_client/widget/repo_list.dart';
|
|
|
|
class RepoListPage extends StatefulWidget {
|
|
final SavedUser savedUser;
|
|
|
|
const RepoListPage({Key? key, required this.savedUser}) : super(key: key);
|
|
|
|
@override
|
|
_RepoListPage createState() => _RepoListPage();
|
|
}
|
|
|
|
class _RepoListPage extends State<RepoListPage> {
|
|
|
|
final GlobalKey<ScaffoldState> _key = GlobalKey();
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
key: _key,
|
|
appBar: AppBar(
|
|
title: const Text("My Repositories"),
|
|
leading: IconButton(
|
|
icon: const Icon(Icons.menu),
|
|
onPressed: () => _key.currentState!.openDrawer(),
|
|
),
|
|
),
|
|
drawer: Drawer(
|
|
child: ListView(
|
|
padding: EdgeInsets.zero,
|
|
children: [
|
|
DrawerHeader(
|
|
decoration: BoxDecoration(
|
|
color: Colors.green,
|
|
),
|
|
child: Row(
|
|
|
|
children: [
|
|
Container(padding: EdgeInsets.all(5),child: Image.network(widget.savedUser.authedUser.avatarUrl!,width: 60,)),
|
|
Text(
|
|
widget.savedUser.authedUser.username!,
|
|
style:
|
|
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
color: Colors.lightGreen[100],
|
|
child: const ListTile(
|
|
title: Text('My Repositories'),
|
|
),
|
|
),
|
|
const ListTile(
|
|
title: Text('Explore'),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
body: BlocProvider(
|
|
create: (_) => RepoBloc(
|
|
giteaService: GiteaService(apiAccess: widget.savedUser.apiAccess))
|
|
..add(RepoFetched()),
|
|
child: ReposList(user: widget.savedUser, ),
|
|
),
|
|
);
|
|
}
|
|
}
|