mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 19:47:47 +08:00
feat: small screen
This commit is contained in:
@@ -11,6 +11,7 @@ import 'package:ui/settings/settings.dart';
|
|||||||
import 'package:ui/system_page.dart';
|
import 'package:ui/system_page.dart';
|
||||||
import 'package:ui/tv_details.dart';
|
import 'package:ui/tv_details.dart';
|
||||||
import 'package:ui/welcome_page.dart';
|
import 'package:ui/welcome_page.dart';
|
||||||
|
import 'package:ui/widgets/utils.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
@@ -49,7 +50,9 @@ class _MyAppState extends ConsumerState<MyApp> {
|
|||||||
builder: (BuildContext context, GoRouterState state, Widget child) {
|
builder: (BuildContext context, GoRouterState state, Widget child) {
|
||||||
return SelectionArea(
|
return SelectionArea(
|
||||||
child: MainSkeleton(
|
child: MainSkeleton(
|
||||||
body: Padding(padding: const EdgeInsets.all(20), child: child),
|
body: Padding(
|
||||||
|
padding: EdgeInsets.all(isSmallScreen(context) ? 5 : 20),
|
||||||
|
child: child),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -128,8 +131,7 @@ class _MyAppState extends ConsumerState<MyApp> {
|
|||||||
colorScheme: ColorScheme.fromSeed(
|
colorScheme: ColorScheme.fromSeed(
|
||||||
seedColor: Colors.blueAccent,
|
seedColor: Colors.blueAccent,
|
||||||
brightness: Brightness.dark,
|
brightness: Brightness.dark,
|
||||||
surface: Colors.black87
|
surface: Colors.black87),
|
||||||
),
|
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
//scaffoldBackgroundColor: Color.fromARGB(255, 26, 24, 24)
|
//scaffoldBackgroundColor: Color.fromARGB(255, 26, 24, 24)
|
||||||
tooltipTheme: TooltipThemeData(
|
tooltipTheme: TooltipThemeData(
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class WelcomePage extends ConsumerWidget {
|
|||||||
return switch (data) {
|
return switch (data) {
|
||||||
AsyncData(:final value) => SingleChildScrollView(
|
AsyncData(:final value) => SingleChildScrollView(
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
spacing: isSmallScreen(context) ? 5 : 10,
|
spacing: isSmallScreen(context) ? 0 : 10,
|
||||||
runSpacing: isSmallScreen(context) ? 10 : 20,
|
runSpacing: isSmallScreen(context) ? 10 : 20,
|
||||||
children: value.isEmpty
|
children: value.isEmpty
|
||||||
? [
|
? [
|
||||||
@@ -57,7 +57,7 @@ class WelcomePage extends ConsumerWidget {
|
|||||||
|
|
||||||
class MediaCard extends StatelessWidget {
|
class MediaCard extends StatelessWidget {
|
||||||
final MediaDetail item;
|
final MediaDetail item;
|
||||||
static const double smallWidth = 110;
|
static const double smallWidth = 126;
|
||||||
static const double largeWidth = 140;
|
static const double largeWidth = 140;
|
||||||
|
|
||||||
const MediaCard({super.key, required this.item});
|
const MediaCard({super.key, required this.item});
|
||||||
|
|||||||
@@ -58,3 +58,7 @@ bool isDesktop() {
|
|||||||
return Platform.isLinux || Platform.isWindows || Platform.isMacOS;
|
return Platform.isLinux || Platform.isWindows || Platform.isMacOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isSmallScreen(BuildContext context) {
|
||||||
|
final screenWidth = MediaQuery.of(context).size.width;
|
||||||
|
return screenWidth < 600;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user