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.

57 lines
2.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/modules/cx_module/chat/chat_provider.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
class ViewAllAttachmentPage extends StatefulWidget {
int moduleId;
int requestId;
ViewAllAttachmentPage({required this.moduleId, required this.requestId, Key? key}) : super(key: key);
@override
_ViewAllAttachmentPageState createState() {
return _ViewAllAttachmentPageState();
}
}
class _ViewAllAttachmentPageState extends State<ViewAllAttachmentPage> {
@override
void initState() {
super.initState();
Provider.of<ChatProvider>(context, listen: false).viewAllDocuments(widget.moduleId, widget.requestId);
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColor.neutral100,
appBar: const DefaultAppBar(title: "Documents"),
body: FutureBuilder(
future: Provider.of<ChatProvider>(context, listen: false).viewAllDocuments(widget.moduleId, widget.requestId),
builder: (BuildContext context, AsyncSnapshot snapshot) {
bool isLoading = false;
if (snapshot.connectionState == ConnectionState.waiting) {
isLoading = true;
}
return GridView.builder(
itemCount: 9, //isLoading? 9: 2,
padding: const EdgeInsets.all(16),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: context.isTablet() ? 4 : 3, childAspectRatio: 1, crossAxisSpacing: 8, mainAxisSpacing: 8),
itemBuilder: (BuildContext context, int index) {
return Container().toShimmer(context: context, isShow: isLoading);
},
);
}),
);
}
}