This commit is contained in:
parent
40afd685dd
commit
fe7c5b65e8
|
@ -27,36 +27,31 @@ class _ItemPageState extends State<ItemPage> with SingleTickerProviderStateMixin
|
|||
return FutureBuilder<Item>(
|
||||
future: f0ck,
|
||||
builder: (context, snapshot) {
|
||||
if(snapshot.hasData) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('f0ck $id'),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: 1,
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
if(!snapshot.hasData) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
final deviceSize = MediaQuery.of(context).size;
|
||||
//final aspectRatio = widget.item.width / widget.item.height;
|
||||
//final containerHeight = deviceSize.width / aspectRatio;
|
||||
|
||||
return RefreshIndicator(
|
||||
onRefresh: () {
|
||||
return fetchItemFromApi(id);
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: deviceSize.width,
|
||||
height: 550,//containerHeight,
|
||||
child: snapshot.data!.mime.startsWith('image') ? Image.network("https://f0ck.dev/b/${snapshot.data?.dest}") : const Text("no image"),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.all(20.0),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"${snapshot.data?.mime}",
|
||||
style: const TextStyle(fontSize: 40),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
);
|
||||
} else if(snapshot.hasError) {
|
||||
return Text("${snapshot.error}");
|
||||
}
|
||||
return const CircularProgressIndicator();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user