Fix releases

This commit is contained in:
franzap
2024-05-08 21:22:55 -03:00
parent b81c766313
commit 1af5c934ff
6 changed files with 142 additions and 128 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ class App extends Event<App> with BaseApp {
// final androidInfo = await deviceInfo.androidInfo;
// return androidInfo.architecture; // e.g. "arm64-v8a"
// }
return releases.latest?.artifacts
return releases.ordered.firstOrNull?.artifacts
.where((a) =>
a.mimeType == 'application/vnd.android.package-archive' &&
a.architectures.contains('arm64-v8a'))
+2 -2
View File
@@ -36,6 +36,6 @@ mixin ReleaseAdapter on Adapter<Release> {
}
extension HasManyReleaseX on HasMany<Release> {
Release? get latest =>
toList().sorted((a, b) => a.createdAt.compareTo(b.createdAt)).firstOrNull;
List<Release> get ordered =>
toList().sorted((a, b) => b.createdAt.compareTo(a.createdAt));
}
-1
View File
@@ -4,7 +4,6 @@ import 'package:collection/collection.dart';
import 'package:flutter_data/flutter_data.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:purplebase/purplebase.dart';
import 'package:zapstore/main.data.dart';
import 'package:zapstore/models/nostr_adapter.dart';
part 'user.g.dart';
+134 -122
View File
@@ -8,7 +8,6 @@ import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:gap/gap.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:intl/intl.dart';
import 'package:purplebase/purplebase.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:zapstore/main.dart';
import 'package:zapstore/main.data.dart';
@@ -37,142 +36,150 @@ class AppDetailScreen extends HookConsumerWidget {
final app = state.model ?? model;
return Column(
children: [
Expanded(
child: CustomScrollView(
slivers: [
// SliverAppBar(
// pinned: true,
// leading: IconButton(
// icon: Icon(Icons.arrow_back),
// onPressed: () {
// context.pop();
// },
// ),
// ),
SliverList(
delegate: SliverChildListDelegate(
[
VersionedAppHeader(app: app),
Gap(16),
if (app.images.isNotEmpty)
Scrollbar(
controller: scrollController,
interactive: true,
trackVisibility: true,
child: SingleChildScrollView(
return RefreshIndicator(
onRefresh: () => ref.apps.findOne(model.id!),
child: Column(
children: [
Expanded(
child: CustomScrollView(
slivers: [
// SliverAppBar(
// pinned: true,
// leading: IconButton(
// icon: Icon(Icons.arrow_back),
// onPressed: () {
// context.pop();
// },
// ),
// ),
SliverList(
delegate: SliverChildListDelegate(
[
VersionedAppHeader(app: app),
Gap(16),
if (app.images.isNotEmpty)
Scrollbar(
controller: scrollController,
scrollDirection: Axis.horizontal,
child: SizedBox(
height: 320,
child: Row(
children: [
for (final i in app.images)
Padding(
padding: const EdgeInsets.only(right: 12),
child: CachedNetworkImage(imageUrl: i),
),
],
interactive: true,
trackVisibility: true,
child: SingleChildScrollView(
controller: scrollController,
scrollDirection: Axis.horizontal,
child: SizedBox(
height: 320,
child: Row(
children: [
for (final i in app.images)
Padding(
padding: const EdgeInsets.only(right: 12),
child: CachedNetworkImage(imageUrl: i),
),
],
),
),
),
),
Divider(height: 24),
MarkdownBody(
styleSheet: MarkdownStyleSheet(
h1: TextStyle(fontWeight: FontWeight.bold),
h2: TextStyle(fontWeight: FontWeight.bold),
p: TextStyle(
fontSize: 18, fontWeight: FontWeight.w300),
),
selectable: false,
data: app.content,
),
Divider(height: 24),
MarkdownBody(
styleSheet: MarkdownStyleSheet(
h1: TextStyle(fontWeight: FontWeight.bold),
h2: TextStyle(fontWeight: FontWeight.bold),
p: TextStyle(fontSize: 18, fontWeight: FontWeight.w300),
Gap(10),
Padding(
padding: const EdgeInsets.only(right: 14),
child: SignerAndDeveloperRow(app: app),
),
selectable: false,
data: app.content,
),
Gap(10),
Padding(
padding: const EdgeInsets.only(right: 14),
child: SignerAndDeveloperRow(app: app),
),
Gap(30),
Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.grey[900],
borderRadius: BorderRadius.circular(10),
),
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(child: Text('Source')),
Flexible(
child: AutoSizeText(
app.repository!,
minFontSize: 11,
maxLines: 1,
overflow: TextOverflow.ellipsis,
Gap(30),
Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.grey[900],
borderRadius: BorderRadius.circular(10),
),
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
SizedBox(child: Text('Source')),
Flexible(
child: AutoSizeText(
app.repository!,
minFontSize: 11,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
),
],
],
),
),
),
Padding(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Github stars'),
Text(app.githubStars)
],
Padding(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text('Github stars'),
Text(app.githubStars)
],
),
),
),
Padding(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Github forks'),
Text(app.githubForks)
],
Padding(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text('Github forks'),
Text(app.githubForks)
],
),
),
),
Padding(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [Text('License'), Text(app.license)],
Padding(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [Text('License'), Text(app.license)],
),
),
),
],
],
),
),
),
Divider(height: 50),
Text(
'Releases'.toUpperCase(),
style: TextStyle(
fontSize: 16,
letterSpacing: 3,
fontWeight: FontWeight.w300,
Divider(height: 50),
Text(
'Releases'.toUpperCase(),
style: TextStyle(
fontSize: 16,
letterSpacing: 3,
fontWeight: FontWeight.w300,
),
),
),
for (final release in app.releases.toList())
ReleaseCard(release: release),
],
for (final release in app.releases.ordered)
ReleaseCard(release: release),
],
),
),
),
],
],
),
),
),
SizedBox(
height: 50,
child: Center(
child: InstallButton(app: app),
SizedBox(
height: 50,
child: Center(
child: InstallButton(app: app),
),
),
),
],
],
),
);
}
}
@@ -312,7 +319,12 @@ class ReleaseCard extends StatelessWidget {
Text(release.version,
style: TextStyle(fontSize: 26, fontWeight: FontWeight.bold)),
Gap(10),
MarkdownBody(data: release.content),
Container(
constraints: BoxConstraints(
maxHeight: 260,
),
child: Markdown(data: release.content),
),
Gap(30),
if (metadata != null)
Padding(
+1
View File
@@ -171,6 +171,7 @@ class CircularImage extends StatelessWidget {
child: Icon(
Icons.person,
color: Colors.blueGrey,
size: size * 0.7,
),
);
return ClipRRect(
+4 -2
View File
@@ -25,7 +25,7 @@ dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
flutter_data: ^1.6.0
flutter_data: ^2.0.0-rc3
hooks_riverpod: ^2.4.9
json_annotation: ^4.8.1
flutter_hooks: ^0.20.4
@@ -59,7 +59,9 @@ dependency_overrides:
url: https://github.com/purplebase/purplebase
ref: f6a6a7
flutter_data:
path: ../flutter_data
git:
url: https://github.com/flutterdata/flutter_data
ref: e54a2e
dev_dependencies:
flutter_test: