forked from Cutlery/immich
		
	fix(mobile): Remove unsplash placeholder image and style empty places, objects (#1742)
This commit is contained in:
		
							parent
							
								
									11b2e2a6e2
								
							
						
					
					
						commit
						37cfac27b8
					
				@ -145,8 +145,6 @@
 | 
			
		||||
  "profile_drawer_settings": "Settings",
 | 
			
		||||
  "profile_drawer_sign_out": "Sign Out",
 | 
			
		||||
  "search_bar_hint": "Search your photos",
 | 
			
		||||
  "search_page_no_objects": "No Objects Info Available",
 | 
			
		||||
  "search_page_no_places": "No Places Info Available",
 | 
			
		||||
  "search_page_places": "Places",
 | 
			
		||||
  "search_page_things": "Things",
 | 
			
		||||
  "search_result_page_new_search_hint": "New Search",
 | 
			
		||||
 | 
			
		||||
@ -7,18 +7,21 @@ class ThumbnailWithInfo extends StatelessWidget {
 | 
			
		||||
  const ThumbnailWithInfo({
 | 
			
		||||
    Key? key,
 | 
			
		||||
    required this.textInfo,
 | 
			
		||||
    required this.imageUrl,
 | 
			
		||||
    this.imageUrl,
 | 
			
		||||
    this.noImageIcon,
 | 
			
		||||
    required this.onTap,
 | 
			
		||||
  }) : super(key: key);
 | 
			
		||||
 | 
			
		||||
  final String textInfo;
 | 
			
		||||
  final String imageUrl;
 | 
			
		||||
  final String? imageUrl;
 | 
			
		||||
  final Function onTap;
 | 
			
		||||
  final IconData? noImageIcon;
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
    var box = Hive.box(userInfoBox);
 | 
			
		||||
 | 
			
		||||
    var isDarkMode = Theme.of(context).brightness == Brightness.dark;
 | 
			
		||||
    var textAndIconColor = isDarkMode ? Colors.grey[100] : Colors.grey[700];
 | 
			
		||||
    return GestureDetector(
 | 
			
		||||
      onTap: () {
 | 
			
		||||
        onTap();
 | 
			
		||||
@ -31,26 +34,37 @@ class ThumbnailWithInfo extends StatelessWidget {
 | 
			
		||||
            alignment: Alignment.bottomCenter,
 | 
			
		||||
            children: [
 | 
			
		||||
              Container(
 | 
			
		||||
                foregroundDecoration: BoxDecoration(
 | 
			
		||||
                  borderRadius: BorderRadius.circular(10),
 | 
			
		||||
                  color: Colors.black26,
 | 
			
		||||
                ),
 | 
			
		||||
                child: ClipRRect(
 | 
			
		||||
                  borderRadius: BorderRadius.circular(10),
 | 
			
		||||
                  child: CachedNetworkImage(
 | 
			
		||||
                    width: 250,
 | 
			
		||||
                    height: 250,
 | 
			
		||||
                    fit: BoxFit.cover,
 | 
			
		||||
                    imageUrl: imageUrl,
 | 
			
		||||
                    httpHeaders: {
 | 
			
		||||
                      "Authorization": "Bearer ${box.get(accessTokenKey)}"
 | 
			
		||||
                    },
 | 
			
		||||
                decoration: BoxDecoration(
 | 
			
		||||
                  borderRadius: BorderRadius.circular(25),
 | 
			
		||||
                  color: isDarkMode ? Colors.grey[900] : Colors.grey[100],
 | 
			
		||||
                  border: Border.all(
 | 
			
		||||
                    color: isDarkMode ? Colors.grey[800]! : Colors.grey[400]!,
 | 
			
		||||
                    width: 1,
 | 
			
		||||
                  ),
 | 
			
		||||
                ),
 | 
			
		||||
                child: imageUrl != null
 | 
			
		||||
                    ? ClipRRect(
 | 
			
		||||
                        borderRadius: BorderRadius.circular(20),
 | 
			
		||||
                        child: CachedNetworkImage(
 | 
			
		||||
                          width: 250,
 | 
			
		||||
                          height: 250,
 | 
			
		||||
                          fit: BoxFit.cover,
 | 
			
		||||
                          imageUrl: imageUrl!,
 | 
			
		||||
                          httpHeaders: {
 | 
			
		||||
                            "Authorization": "Bearer ${box.get(accessTokenKey)}"
 | 
			
		||||
                          },
 | 
			
		||||
                        ),
 | 
			
		||||
                      )
 | 
			
		||||
                    : Center(
 | 
			
		||||
                        child: Icon(
 | 
			
		||||
                          noImageIcon ?? Icons.not_listed_location,
 | 
			
		||||
                          color: textAndIconColor,
 | 
			
		||||
                        ),
 | 
			
		||||
                      ),
 | 
			
		||||
              ),
 | 
			
		||||
              Positioned(
 | 
			
		||||
                bottom: 8,
 | 
			
		||||
                left: 10,
 | 
			
		||||
                bottom: 12,
 | 
			
		||||
                left: 14,
 | 
			
		||||
                child: SizedBox(
 | 
			
		||||
                  width: MediaQuery.of(context).size.width / 3,
 | 
			
		||||
                  child: Text(
 | 
			
		||||
@ -58,7 +72,7 @@ class ThumbnailWithInfo extends StatelessWidget {
 | 
			
		||||
                    style: const TextStyle(
 | 
			
		||||
                      color: Colors.white,
 | 
			
		||||
                      fontWeight: FontWeight.bold,
 | 
			
		||||
                      fontSize: 14,
 | 
			
		||||
                      fontSize: 12,
 | 
			
		||||
                    ),
 | 
			
		||||
                  ),
 | 
			
		||||
                ),
 | 
			
		||||
 | 
			
		||||
@ -85,9 +85,7 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
                    itemCount: 1,
 | 
			
		||||
                    itemBuilder: ((context, index) {
 | 
			
		||||
                      return ThumbnailWithInfo(
 | 
			
		||||
                        imageUrl:
 | 
			
		||||
                            'https://images.unsplash.com/photo-1612178537253-bccd437b730e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8NXx8Ymxhbmt8ZW58MHx8MHx8&auto=format&fit=crop&w=700&q=60',
 | 
			
		||||
                        textInfo: 'search_page_no_places'.tr(),
 | 
			
		||||
                        textInfo: '',
 | 
			
		||||
                        onTap: () {},
 | 
			
		||||
                      );
 | 
			
		||||
                    }),
 | 
			
		||||
@ -140,9 +138,8 @@ class SearchPage extends HookConsumerWidget {
 | 
			
		||||
                    itemCount: 1,
 | 
			
		||||
                    itemBuilder: ((context, index) {
 | 
			
		||||
                      return ThumbnailWithInfo(
 | 
			
		||||
                        imageUrl:
 | 
			
		||||
                            'https://images.unsplash.com/photo-1612178537253-bccd437b730e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8NXx8Ymxhbmt8ZW58MHx8MHx8&auto=format&fit=crop&w=700&q=60',
 | 
			
		||||
                        textInfo: 'search_page_no_objects'.tr(),
 | 
			
		||||
                        textInfo: '',
 | 
			
		||||
                        noImageIcon: Icons.signal_cellular_no_sim_sharp,
 | 
			
		||||
                        onTap: () {},
 | 
			
		||||
                      );
 | 
			
		||||
                    }),
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user