Skip to content

Commit

Permalink
fix: use lower case in image name
Browse files Browse the repository at this point in the history
  • Loading branch information
evan361425 committed Mar 29, 2023
1 parent 43ec669 commit c28c31f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
5 changes: 4 additions & 1 deletion lib/components/style/sliding_up_opener.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class SlidingUpOpener extends StatefulWidget {
/// The height of the sliding panel when fully open.
final double maxHeight;

final double heightOffset;

/// If non-null, shows a darkening shadow over the [body] as
/// the panel slides open.
final bool backdropEnabled;
Expand Down Expand Up @@ -67,6 +69,7 @@ class SlidingUpOpener extends StatefulWidget {
this.minHeight = 160.0,
this.maxHeight = 500.0,
this.borderRadius = 16.0,
this.heightOffset = 0.0,
this.backdropEnabled = true,
this.catchPopScope = true,
this.clickToOpen = true,
Expand Down Expand Up @@ -109,7 +112,7 @@ class SlidingUpOpenerState extends State<SlidingUpOpener> {
collapsed: buildCollapsed(),
body: Column(children: [
Expanded(child: widget.body),
SizedBox(height: widget.minHeight + 80),
SizedBox(height: widget.minHeight + widget.heightOffset + 80),
]),
);

Expand Down
2 changes: 1 addition & 1 deletion lib/ui/image_gallery_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class ImageGalleryScreenState extends State<ImageGalleryScreen> {
.replaceFirst('.', '');
// 原本檔名是 uuid v4 產生,前綴為 [0-9A-F],
// 為了做區別而設計成這樣。
final dst = XFile.fs.path.join(baseDir.path, 'G$name');
final dst = XFile.fs.path.join(baseDir.path, 'g$name');
Log.ger('save_image', 'start', dst);

// avator first, avoid different with origin one
Expand Down
1 change: 1 addition & 0 deletions lib/ui/order/cashier/order_cashier_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class _OrderCashierModalState extends State<OrderCashierModal> {
// 4 rows * 64 + 24 (insets) + 64 (collapse)
maxHeight: 408,
minHeight: 84,
heightOffset: 58,
renderPanelSheet: false,
body: body,
panel: panel,
Expand Down
17 changes: 9 additions & 8 deletions test/image_gallery_screen_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ void main() {
await tester.tap(find.byKey(const Key('image_gallery.add')));
await tester.pumpAndSettle();

expect(imagePath, startsWith('menu_image/G20'));
final pattern = RegExp('menu_image/g[0-9]{8}T[0-9]{12}');
expect(pattern.hasMatch(imagePath!), isTrue);
expect(XFile('$imagePath-avator').file.existsSync(), isTrue);
});

Expand Down Expand Up @@ -87,10 +88,10 @@ void main() {

testWidgets('delete selected', (tester) async {
final gallery = GlobalKey<ImageGalleryScreenState>();
await createImageAt('G20230102030405111');
await createImageAt('G20230102030405222');
await createImageAt('G20230102030405222-avator');
await createImageAt('G20230102030405333');
await createImageAt('g20230102030405111');
await createImageAt('g20230102030405222');
await createImageAt('g20230102030405222-avator');
await createImageAt('g20230102030405333');

await tester.pumpWidget(MaterialApp(
home: ImageGalleryScreen(key: gallery),
Expand Down Expand Up @@ -144,8 +145,8 @@ void main() {
expect(
gallery.currentState!.images,
equals([
'menu_image/G20230102030405333',
'menu_image/G20230102030405111',
'menu_image/g20230102030405333',
'menu_image/g20230102030405111',
]),
);

Expand All @@ -159,7 +160,7 @@ void main() {

expect(
gallery.currentState!.images,
equals(['menu_image/G20230102030405333']),
equals(['menu_image/g20230102030405333']),
);
});

Expand Down

0 comments on commit c28c31f

Please sign in to comment.