Posts

Showing posts with the label ios

[Flutter] Get some special directories path

Image
I'm sure, if you are a Flutter's developer, that you will need one day to get specific paths, for instance to store files, generate temporary files etc... Path_provider package For that I use the 'path_provider' package that has some helpers methods. For example: Future < Directory >   getApplicationDocumentsDirectory ( ) returns the documents directory. How to use it ? Directory tempDir = await getTemporaryDirectory(); String tempPath = tempDir.path; Directory appDocDir = await getApplicationDocumentsDirectory(); String appDocPath = appDocDir.path; Follow the links: Package:  https://pub.dev/packages/path_provider Package's documentation:  https://pub.dev/documentation/path_provider/latest/index.html

[Flutter] Splashscreen (native way)

Image
The splash screen is the first screen you see when you start your app. - you can display your logo for instance - and while the splash screen is shown,  your application is loaded (like user data, business data...) In this example we will use flutter_native_splash package. I- Package: flutter_native_splash (for native splash screen) In your " pubspec.yaml " file you have to add the correct dependency, here at less version 2.0.5 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions # consider running `flutter pub upgrade --major-versions`. Alternatively, # dependencies can be manually updated by changing the version numbers below to # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies : flutter : sdk : flutter flutter_native_splash : ^2.0.5 hint : Pubspec Assist extension To auto

XAMARIN FORMS TIPS: iOS 15 Transparent TabBar and Safe Area

Image
  iOS 15, transparent TabBar Since the release of iOS 15, some people had regression with their app, particularly because of the TabBar component . In iOS 15, by default (while using Xamarin Forms), the TabBar comes with a Transparent background and the page's content can scroll behind this TabBar. So it's not user friendly  and I presume for all existing apps, it's not beautiful. See the next picture: iOS 15, transparent TabBar You can solve this problem by many ways, but the fastest solution / workaround that I found is the following: => manage iOS SafeArea directly into your XAML to constrain page's content to fit the free space of the page.  You can do that in XAML in 2 lines of code: <?xml version="1.0" encoding="UTF-8" ?> <ContentPage xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core" ios:Page.UseSafeArea="True" ... iOS 15 using Page.UseSafeArea = true As Ta

EMGU with Xamarin Forms guide [part 1]

Image
I- Introduction, OpenCV and EMGU Do you know OpenCV ( Open Source Computer Vision Library:  https://opencv.org/ ) ?  This open source library let's you work and play with images and videos with a lot of powerful image processing algorithms !  If you want some details, I suggest you to first navigate to the link above or search for 'OpenCV' on Google.  Examples of OpenCV processing found on the web (filters, object detection, edges...): EMGU is a .NET OpenCV wrapper. That means that you will be able to use OpenCV functionnalities in your .NET projects using C# for instance. EMGU is cross platform, so you will also be able to use it in your Xamarin projects ! That's great because there is no advanced image processing library in Xamarin. In this article, we will talk about EMGU and list the steps to setup a Xamarin Forms project using EMGU . It may help you because, we must say that it's not a trivial task...  II-What do I need to

Xamarin Forms essential: FFImageLoading, manage your images

Image
Discover 'FFLoadingImage' library Today I want to make a quick presentation of a really good library for Xamarin Forms . This is the kind of library we would like to see more often on XF... This one is dedicated to image manipulation. It's called " FFImageLoading ". If I take time to make this presentation, it's because I think that we should use it in almost all our "basic" Xamarin Forms applications. When I say basic, I exclude Games or other specific apps. But in my mind, I suggest you to change all your traditional "<Image />" by "<FF:CachedImage />" in your apps. Before to start, where to find it ? On Github:  https://github.com/luberda-molinet/FFImageLoading On Nuget:  https://www.nuget.org/packages/Xamarin.FFImageLoading Main features So what will you find using this library ? I will not explain all the details but the main interesting features of the library. Multi-platform The good po

[Xamarin Forms] Custom bottom bordered entry (iOS & Android)

Image
Custom entry with renderers For my Xamarin Forms project I needed to render an 'Entry' control with a bottom border of a specific color. There are several possibilities but I will show you mine. For that, I used renderers. iOS one is particularly not trivial. The wished result look like that: iOS Renderer [assembly: ExportRenderer(typeof(ExtDatePicker), typeof(ExtDatePickerRenderer))] namespace MyCompany.iOS.Renderers { public class ExtDatePickerRenderer : DatePickerRenderer { protected override void OnElementChanged(ElementChangedEventArgs<DatePicker> e) { base.OnElementChanged(e); // Need to connect to Sizechanged event because first render time, Entry has no size (-1). if (e.NewElement != null) e.NewElement.SizeChanged += (obj, args) => { var xamEl = obj as DatePicker; if (xamEl == null) ret

Xamarin.forms.Maps - Tap to get a position on the map...

Image
Xamarin.Forms.Map component Xamarin.Forms.Maps is a great component. It gives you the possibility to deal with maps and geolocation problematics in a few lines of code. This "Map" component internally use native map controls for iOS, Android and Windows Phone: You can display and locate "Pins" with custom information on the map. I suggest you to read the reference links above. Display pins with custom information The problem But actually, in my mind, the Map control miss a very important feature: --> Tap  on the map to get the relative location (to put a new pin, to get the relative address...) The workaround Use renderers Actually, to solve this problem, we need to implement custom renderers for iOS and Android. Maybe this feature will be implemented later by Xamarin... So here is my solution (3 code files below): - ExtMap.cs : overloaded map control that will contain our "Tapped" event to get the tapped location

Xamarin.Forms device unique ID...

As in a lot of applications, you will probably need to get a unique identifier to identify a unique user . And it becomes a little more complicated when you have to deal with different platforms like Android, iOS and Windows Phone... Here is a simple solution that you can implement in Xamarin Forms that I found on this blog: http://codeworks.it/blog/?p=260 First define a service that you will use in your Xamarin Forms Application: // Your service interface definition public interface IDevice { string GetIdentifier(); } // How you get your service in your app IDevice device = DependencyService.Get (); string deviceIdentifier = device.GetIdentifier(); And here are the implementations for Android / Windows Phone and the most complicated, iOS platform: // WINDOWS PHONE [assembly: Xamarin.Forms.Dependency(typeof(WinPhoneDevice))] namespace XFUniqueIdentifier.WinPhone { public class WinPhoneDevice : IDevice { public string GetIdentifier() { byte[] myDeviceId = (