3 Commits

Author SHA1 Message Date
fe7c5b65e8 new itemview
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-30 07:34:46 +02:00
40afd685dd refresh 2022-05-30 07:34:42 +02:00
dd9a61bcca draft! 2022-05-30 07:34:35 +02:00
3 changed files with 42 additions and 36 deletions

View File

@ -12,6 +12,7 @@ steps:
api_key:
from_secret: gitea_api_key
base_url: https://git.lat
draft: true
files: build/app/outputs/apk/release/app-release.apk
when:
event:

View File

@ -20,6 +20,13 @@ class _HomeState extends State<Home> {
f0cks = fetchDataFromApi();
}
Future loadf0cks() {
setState(() {
f0cks = fetchDataFromApi();
});
return f0cks;
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -32,8 +39,14 @@ class _HomeState extends State<Home> {
body: FutureBuilder<List<Item>>(
future: f0cks,
builder: (context, snapshot) {
if(snapshot.hasData) {
return CustomScrollView(
if(!snapshot.hasData) {
return Text("${snapshot.error}");
}
return RefreshIndicator(
onRefresh: () {
return loadf0cks();
},
child: CustomScrollView(
shrinkWrap: true,
slivers: <Widget>[
SliverGrid(
@ -83,11 +96,8 @@ class _HomeState extends State<Home> {
)
),
]
)
);
} else if(snapshot.hasError) {
return Text("${snapshot.error}");
}
return const CircularProgressIndicator();
}
)
);

View File

@ -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();
}
);
}