123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- import 'package:flutter/material.dart';
- import '../models/bbs.dart';
- import '../constants.dart';
- class BbsListView extends StatefulWidget {
- final String type;
- final String page;
- final String size;
- BbsListView({Key key,
- this.type,
- this.page,
- this.size
- }) : super(key: key);
- @override
- _BbsListViewState createState() => _BbsListViewState();
- }
- class _BbsListViewState extends State<BbsListView> {
- @override
- void initState() {
- // TODO: implement initState
- super.initState();
- albumBloc.bbs(widget.type,widget.page,widget.size);
- }
- @override
- void dispose() {
- // TODO: implement dispose
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return StreamBuilder(
- stream: albumBloc.bbsList,
- builder: (context, snapshot) {
- if (!snapshot.hasData) {
- return Center(
- child: CircularProgressIndicator(),
- );
- }
- return ListView.separated(
- itemCount: snapshot.data.result.length,
- separatorBuilder: (BuildContext context, int index) => Divider(thickness: 0.2,color: Colors.grey,height: 0.2,),
- itemBuilder: (BuildContext context, int index) {
- return ExpansionTile(
- title: Text(snapshot.data.result[index].title,),
- children: [
- Divider(),
- ListTile(
- title: Text(snapshot.data.result[index].content,style: TextStyle(fontSize: 14),),
- )
- ],
- );
- },
- );
- },
- );
- }
- }
|