2024-08-06 19:06:38 +03:00
|
|
|
|
import 'package:flutter/material.dart';
|
2025-04-27 18:17:40 +03:00
|
|
|
|
import 'package:openstore/app_page.dart';
|
2024-08-06 19:06:38 +03:00
|
|
|
|
import 'package:openstore/search_page.dart';
|
2025-04-27 18:17:40 +03:00
|
|
|
|
import 'package:go_router/go_router.dart';
|
2025-04-27 19:42:53 +03:00
|
|
|
|
import 'package:dynamic_color/dynamic_color.dart';
|
2025-04-27 20:21:17 +03:00
|
|
|
|
import 'package:url_launcher/url_launcher_string.dart';
|
|
|
|
|
import 'dart:io' show Platform;
|
2024-08-06 19:06:38 +03:00
|
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
runApp(const MyApp());
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-27 18:17:40 +03:00
|
|
|
|
final _router = GoRouter(
|
|
|
|
|
routes: [
|
|
|
|
|
GoRoute(path: '/', builder: (context, state) => const HomePage(), routes: [
|
|
|
|
|
GoRoute(
|
|
|
|
|
path: '/app/:id',
|
|
|
|
|
builder: (context, state) =>
|
|
|
|
|
AppPage(packageName: state.pathParameters['id'] ?? ""),
|
|
|
|
|
),
|
|
|
|
|
GoRoute(
|
|
|
|
|
path: 'instruction',
|
|
|
|
|
builder: (context, state) {
|
|
|
|
|
print(state.uri.queryParameters["utm_campaign"]);
|
2025-05-08 14:31:34 +03:00
|
|
|
|
return AppPage(
|
|
|
|
|
packageName: state.uri.queryParameters["utm_campaign"] ??
|
|
|
|
|
"ru.nspk.mirpay");
|
2025-04-27 18:17:40 +03:00
|
|
|
|
})
|
|
|
|
|
]),
|
|
|
|
|
GoRoute(
|
|
|
|
|
path: '/search',
|
|
|
|
|
builder: (context, state) =>
|
|
|
|
|
SearchPage(search: state.uri.queryParameters["q"] ?? "")),
|
|
|
|
|
GoRoute(
|
|
|
|
|
path: '/catalog/app/:id',
|
|
|
|
|
redirect: (_, state) => "/app/${state.pathParameters["id"]}"),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
|
2024-08-06 19:06:38 +03:00
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
|
const MyApp({super.key});
|
|
|
|
|
|
|
|
|
|
// This widget is the root of your application.
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2025-04-27 19:42:53 +03:00
|
|
|
|
return DynamicColorBuilder(
|
|
|
|
|
builder: (lightColorScheme, darkColorScheme) => MaterialApp.router(
|
|
|
|
|
title: 'OpenStore',
|
|
|
|
|
theme: ThemeData(
|
|
|
|
|
colorScheme: darkColorScheme ??
|
|
|
|
|
ColorScheme.fromSeed(
|
|
|
|
|
seedColor: Colors.blue,
|
|
|
|
|
brightness: Brightness.dark,
|
|
|
|
|
),
|
|
|
|
|
useMaterial3: true,
|
|
|
|
|
),
|
|
|
|
|
routerConfig: _router,
|
|
|
|
|
));
|
2024-08-06 19:06:38 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class HomePage extends StatelessWidget {
|
|
|
|
|
const HomePage({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
2025-04-27 20:21:17 +03:00
|
|
|
|
appBar: AppBar(
|
|
|
|
|
title: const Text("OpenStore"),
|
2024-08-06 19:06:38 +03:00
|
|
|
|
),
|
2025-04-27 20:21:17 +03:00
|
|
|
|
body: Center(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
2025-05-08 14:31:12 +03:00
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
onTap: () => launchUrlString(
|
|
|
|
|
"https://codeberg.org/mi6e4ka/openstore/src/branch/main/SAFETY.md"),
|
|
|
|
|
child: const Card(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
child: Row(
|
|
|
|
|
spacing: 8,
|
|
|
|
|
children: [
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.info_rounded,
|
|
|
|
|
size: 32,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"О безопасности приложений",
|
|
|
|
|
style: TextStyle(fontSize: 18),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
),
|
2025-04-27 20:21:17 +03:00
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
const SizedBox(
|
|
|
|
|
width: 15,
|
|
|
|
|
),
|
|
|
|
|
Flexible(
|
|
|
|
|
child: TextField(
|
|
|
|
|
onSubmitted: (value) => context.push(
|
|
|
|
|
Uri(path: '/search', queryParameters: {'q': value})
|
|
|
|
|
.toString()),
|
|
|
|
|
textInputAction: TextInputAction.search,
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
prefixIcon: Icon(Icons.search),
|
|
|
|
|
border: OutlineInputBorder()),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
//const SizedBox(width: 5,),
|
|
|
|
|
//FilledButton(onPressed: (){}, child: Text("GO")),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
width: 15,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () async => await launchUrlString(
|
2025-05-08 14:31:34 +03:00
|
|
|
|
"https://codeberg.org/mi6e4ka/openstore"),
|
2025-04-27 20:21:17 +03:00
|
|
|
|
child: const Text(
|
|
|
|
|
"source code",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
decoration: TextDecoration.underline),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
),
|
2025-04-28 00:20:35 +03:00
|
|
|
|
!Platform.isAndroid ? const Text("|") : Container(),
|
2025-04-27 20:21:17 +03:00
|
|
|
|
!Platform.isAndroid
|
|
|
|
|
? const SizedBox(
|
|
|
|
|
width: 8,
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
!Platform.isAndroid
|
|
|
|
|
? InkWell(
|
|
|
|
|
onTap: () async => await launchUrlString(
|
|
|
|
|
"https://git.mi6e4ka.dev/mi6e4ka/openstore/releases"),
|
|
|
|
|
child: const Text(
|
|
|
|
|
"android app",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
decoration: TextDecoration.underline),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
2025-05-08 14:32:13 +03:00
|
|
|
|
const Text("v1.3.0")
|
2025-04-27 20:21:17 +03:00
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
));
|
2024-08-06 19:06:38 +03:00
|
|
|
|
}
|
2025-04-27 18:17:40 +03:00
|
|
|
|
}
|