feat: small screen

This commit is contained in:
Simon Ding
2024-08-10 11:06:29 +08:00
parent 1391f55f44
commit b62e0e9bfd
3 changed files with 11 additions and 5 deletions

View File

@@ -11,6 +11,7 @@ import 'package:ui/settings/settings.dart';
import 'package:ui/system_page.dart';
import 'package:ui/tv_details.dart';
import 'package:ui/welcome_page.dart';
import 'package:ui/widgets/utils.dart';
void main() {
runApp(const MyApp());
@@ -49,7 +50,9 @@ class _MyAppState extends ConsumerState<MyApp> {
builder: (BuildContext context, GoRouterState state, Widget child) {
return SelectionArea(
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(
seedColor: Colors.blueAccent,
brightness: Brightness.dark,
surface: Colors.black87
),
surface: Colors.black87),
useMaterial3: true,
//scaffoldBackgroundColor: Color.fromARGB(255, 26, 24, 24)
tooltipTheme: TooltipThemeData(

View File

@@ -27,7 +27,7 @@ class WelcomePage extends ConsumerWidget {
return switch (data) {
AsyncData(:final value) => SingleChildScrollView(
child: Wrap(
spacing: isSmallScreen(context) ? 5 : 10,
spacing: isSmallScreen(context) ? 0 : 10,
runSpacing: isSmallScreen(context) ? 10 : 20,
children: value.isEmpty
? [
@@ -57,7 +57,7 @@ class WelcomePage extends ConsumerWidget {
class MediaCard extends StatelessWidget {
final MediaDetail item;
static const double smallWidth = 110;
static const double smallWidth = 126;
static const double largeWidth = 140;
const MediaCard({super.key, required this.item});

View File

@@ -58,3 +58,7 @@ bool isDesktop() {
return Platform.isLinux || Platform.isWindows || Platform.isMacOS;
}
bool isSmallScreen(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
return screenWidth < 600;
}