You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
Dart
46 lines
1.4 KiB
Dart
6 years ago
|
import 'package:famedlysdk/famedlysdk.dart';
|
||
4 years ago
|
import 'package:fluffychat/views/archive.dart';
|
||
4 years ago
|
import 'package:fluffychat/views/widgets/list_items/chat_list_item.dart';
|
||
6 years ago
|
import 'package:flutter/material.dart';
|
||
5 years ago
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||
6 years ago
|
|
||
4 years ago
|
class ArchiveUI extends StatelessWidget {
|
||
4 years ago
|
final ArchiveController controller;
|
||
6 years ago
|
|
||
4 years ago
|
const ArchiveUI(this.controller, {Key key}) : super(key: key);
|
||
6 years ago
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
5 years ago
|
return Scaffold(
|
||
|
appBar: AppBar(
|
||
5 years ago
|
leading: BackButton(),
|
||
5 years ago
|
title: Text(L10n.of(context).archive),
|
||
6 years ago
|
),
|
||
5 years ago
|
body: FutureBuilder<List<Room>>(
|
||
4 years ago
|
future: controller.getArchive(context),
|
||
5 years ago
|
builder: (BuildContext context, snapshot) {
|
||
4 years ago
|
if (snapshot.hasError) {
|
||
|
return Center(
|
||
|
child: Text(
|
||
|
L10n.of(context).oopsSomethingWentWrong,
|
||
|
textAlign: TextAlign.center,
|
||
|
));
|
||
|
}
|
||
5 years ago
|
if (!snapshot.hasData) {
|
||
|
return Center(child: CircularProgressIndicator());
|
||
|
} else {
|
||
4 years ago
|
controller.archive = snapshot.data;
|
||
5 years ago
|
return ListView.builder(
|
||
4 years ago
|
itemCount: controller.archive.length,
|
||
5 years ago
|
itemBuilder: (BuildContext context, int i) => ChatListItem(
|
||
4 years ago
|
controller.archive[i],
|
||
|
onForget: controller.forgetAction,
|
||
|
),
|
||
5 years ago
|
);
|
||
|
}
|
||
|
},
|
||
6 years ago
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|