mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
abc
This commit is contained in:
@@ -3,33 +3,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
||||||
import 'package:immich_ui/immich_ui.dart';
|
import 'package:immich_ui/immich_ui.dart';
|
||||||
|
|
||||||
List<Widget> _showcaseBuilder(Function(ImmichVariant variant, ImmichColor color) builder) {
|
|
||||||
final children = <Widget>[];
|
|
||||||
|
|
||||||
final items = [
|
|
||||||
(variant: ImmichVariant.filled, title: "Filled Variant"),
|
|
||||||
(variant: ImmichVariant.ghost, title: "Ghost Variant"),
|
|
||||||
];
|
|
||||||
|
|
||||||
for (final (:variant, :title) in items) {
|
|
||||||
children.add(Text(title));
|
|
||||||
children.add(Row(spacing: 10, children: [for (var color in ImmichColor.values) builder(variant, color)]));
|
|
||||||
}
|
|
||||||
|
|
||||||
return children;
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ComponentTitle extends StatelessWidget {
|
|
||||||
final String title;
|
|
||||||
|
|
||||||
const _ComponentTitle(this.title);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Text(title, style: context.textTheme.titleLarge);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
class ImmichUIShowcasePage extends StatelessWidget {
|
class ImmichUIShowcasePage extends StatelessWidget {
|
||||||
const ImmichUIShowcasePage({super.key});
|
const ImmichUIShowcasePage({super.key});
|
||||||
@@ -37,63 +10,30 @@ class ImmichUIShowcasePage extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text('Immich UI Showcase')),
|
body: LayoutBuilder(
|
||||||
body: Padding(
|
builder: (context, constraints) {
|
||||||
padding: const EdgeInsets.all(20),
|
final itemHeight = constraints.maxHeight * 0.5; // Each item takes 50% of screen
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
spacing: 10,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
const _ComponentTitle("IconButton"),
|
|
||||||
..._showcaseBuilder(
|
|
||||||
(variant, color) =>
|
|
||||||
ImmichIconButton(icon: Icons.favorite, color: color, variant: variant, onPressed: () {}),
|
|
||||||
),
|
|
||||||
const _ComponentTitle("CloseButton"),
|
|
||||||
..._showcaseBuilder(
|
|
||||||
(variant, color) => ImmichCloseButton(color: color, variant: variant, onPressed: () {}),
|
|
||||||
),
|
|
||||||
const _ComponentTitle("TextButton"),
|
|
||||||
|
|
||||||
ImmichTextButton(
|
return PageView.builder(
|
||||||
labelText: "Text Button",
|
scrollDirection: Axis.vertical,
|
||||||
onPressed: () {},
|
controller: PageController(
|
||||||
variant: ImmichVariant.filled,
|
viewportFraction: 0.5, // Shows 2 items at once
|
||||||
color: ImmichColor.primary,
|
),
|
||||||
),
|
itemCount: 2,
|
||||||
ImmichTextButton(
|
itemBuilder: (context, index) {
|
||||||
labelText: "Text Button",
|
final colors = [Colors.blue, Colors.green];
|
||||||
onPressed: () {},
|
final labels = ['First Item', 'Second Item'];
|
||||||
variant: ImmichVariant.filled,
|
|
||||||
color: ImmichColor.primary,
|
return Center(
|
||||||
loading: true,
|
child: Container(
|
||||||
),
|
padding: const EdgeInsets.all(24),
|
||||||
ImmichTextButton(
|
color: colors[index],
|
||||||
labelText: "Text Button",
|
child: Text(labels[index], style: const TextStyle(color: Colors.white, fontSize: 24)),
|
||||||
onPressed: () {},
|
|
||||||
variant: ImmichVariant.ghost,
|
|
||||||
color: ImmichColor.primary,
|
|
||||||
),
|
|
||||||
ImmichTextButton(
|
|
||||||
labelText: "Text Button",
|
|
||||||
onPressed: () {},
|
|
||||||
variant: ImmichVariant.ghost,
|
|
||||||
color: ImmichColor.primary,
|
|
||||||
loading: true,
|
|
||||||
),
|
|
||||||
const _ComponentTitle("Form"),
|
|
||||||
ImmichForm(
|
|
||||||
onSubmit: () {},
|
|
||||||
child: const Column(
|
|
||||||
spacing: 10,
|
|
||||||
children: [ImmichTextInput(label: "Title", hintText: "Enter a title")],
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
],
|
},
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (distanceToOrigin > openThreshold && !showingBottomSheet && !ref.read(readonlyModeProvider)) {
|
if (distanceToOrigin > openThreshold && !showingBottomSheet && !ref.read(readonlyModeProvider)) {
|
||||||
_openBottomSheet(ctx);
|
// _openBottomSheet(ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user