2020-02-02 10:30:48 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:git_touch/models/auth.dart';
|
|
|
|
import 'package:git_touch/models/bitbucket.dart';
|
|
|
|
import 'package:git_touch/scaffolds/list_stateful.dart';
|
|
|
|
import 'package:git_touch/widgets/app_bar_title.dart';
|
|
|
|
import 'package:git_touch/widgets/repository_item.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
2021-01-05 10:25:19 +01:00
|
|
|
import '../generated/l10n.dart';
|
2020-02-02 10:30:48 +01:00
|
|
|
|
2020-02-02 10:47:05 +01:00
|
|
|
class BbExploreScreen extends StatelessWidget {
|
2020-02-02 10:30:48 +01:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return ListStatefulScaffold<BbRepo, String>(
|
2021-01-05 10:25:19 +01:00
|
|
|
title: AppBarTitle(S.of(context).explore),
|
2020-10-06 14:52:40 +02:00
|
|
|
fetch: (nextUrl) async {
|
2020-10-04 16:10:05 +02:00
|
|
|
final res = await context.read<AuthModel>().fetchBbWithPage(
|
|
|
|
nextUrl ?? '/repositories?role=member&sort=-updated_on');
|
|
|
|
return ListPayload(
|
|
|
|
cursor: res.cursor,
|
|
|
|
hasMore: res.hasMore,
|
|
|
|
items: <BbRepo>[
|
|
|
|
for (var v in res.data) BbRepo.fromJson(v),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
2020-02-02 10:30:48 +01:00
|
|
|
itemBuilder: (v) {
|
|
|
|
return RepositoryItem.bb(payload: v);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|