1570111989
Flutter Responsive UI | Learning Platform App - Part 1
This video mainly focuses on making the simplest layout working on multiple devices, portrait, and landscape orientation. And, you will learn tips and tricks to create consistent and responsive Flutter UI.
Flutter Responsive UI | Learning Platform App - Part 2
In this video, you will more about responsive layouts using multiple layout structures for various screen resolutions and configurations.
A lot many people don’t have time to watch the full video, it is better to write an article explaining the core concepts and thought process behind code.
When I came across this design and found appropriate to explain how to create responsive layouts using Flutter SDK.
When we talk about Flutter, we consider the amazing fact that with Flutter we write code once and run on any platform(Android, iOS, Web, Desktop, Embedded, any many more to come…). This impresses and makes you move to Flutter, no matter which mobile platform you come from.
But, how many times has it happened that you have created a screen for iPhone XS and when you run it on Android Phones, you see the most famous exception — RenderFlowException, because the sizes like 24.0, 16.0, etc. that worked for iPhone doesn’t render exactly for Android. This is because both the hardware have different screen configurations like devicePixelRatio and many others.
Well, the end product is — we need a codebase that handles portrait, the landscape for mobile and tablets and multiple mobile phone resolutions. Now, when you are targeting these many devices you already covered Desktop and Web.
Here, in this article, I am trying to cover possible solutions but do not forget to check out the official documentation of Flutter, which covers the responsive widgets that can help in creating the ultimate layout. But, there are some more hacks that you need to use to solve our problem.
I have created a very simple welcome screen mostly dealing with Column, Row and Expanded widgets. We need to have size_config.dart which will give us some multipliers like imageSizeMultiplier
, textMultiplier
, heightMultiplier
, widthMultiplier
. These all have meaningful names, that you can easily understand.
class SizeConfig {
static double _screenWidth;
static double _screenHeight;
static double _blockSizeHorizontal = 0;
static double _blockSizeVertical = 0;
static double textMultiplier;
static double imageSizeMultiplier;
static double heightMultiplier;
static double widthMultiplier;
static bool isPortrait = true;
static bool isMobilePortrait = false;
void init(BoxConstraints constraints, Orientation orientation) {
if (orientation == Orientation.portrait) {
_screenWidth = constraints.maxWidth;
_screenHeight = constraints.maxHeight;
isPortrait = true;
if (_screenWidth < 450) {
isMobilePortrait = true;
}
} else {
_screenWidth = constraints.maxHeight;
_screenHeight = constraints.maxWidth;
isPortrait = false;
isMobilePortrait = false;
}
_blockSizeHorizontal = _screenWidth / 100;
_blockSizeVertical = _screenHeight / 100;
textMultiplier = _blockSizeVertical;
imageSizeMultiplier = _blockSizeHorizontal;
heightMultiplier = _blockSizeVertical;
widthMultiplier = _blockSizeHorizontal;
}
}
You need an entry point for SizeConfig to be initialized. For me, it will be when you load your first widget.
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
return OrientationBuilder(
builder: (context, orientation) {
SizeConfig().init(constraints, orientation);
return MaterialApp(
title: 'Learning Platform Application',
theme: AppTheme.lightTheme,
home: WelcomeScreen(),
);
},
);
},
);
}
}
Whenever there is layout change or orientation change, we can get new values for
textMultiplier
,imageMultiplier
,heightMultiplier
andwidthMultiplier
.
In the above code, if we are in landscape mode, maxHeight
it becomes screen width and maxWidth
becomes the screen height. _blockSizeWidth
and _blocSizeHeight
are the width and height of the block which is 1/100th of the screen.
It’s all up to you to decide when you consider the width of the screen to be mobile’s screen or any other screen. Here, in my case, I have considered the tablet’s portrait and landscape to be landscape category and mobile as portrait only when the screen width is less than 450.
Let us assume the textMultiplier
is 8.01234… something. So, you have to first use the Text
widget for one mobile size you usually work on and see what font size looks good (apart from the fact many companies have designers tell you that). Suppose the fontSize
is 24, then divide fontSize
by textMultiplier
, let’s call this X. X is the number that multiplied with textMultiplier
will give the required fontSize
for every possible screen out there.
Not to forgot, FittedBox is not wrong to use while using
textMultiplier
. I have used a combination of both. It depends on how much space Text has to Fit.
I recommend using ThemeData, TextTheme, and TextStyles in styling.dart as I did for this project.
class AppTheme {
AppTheme._();
static const Color appBackgroundColor = Color(0xFFFFF7EC);
static const Color subTitleTextColor = Color(0xFF9F988F);
static final ThemeData lightTheme = ThemeData(
scaffoldBackgroundColor: AppTheme.appBackgroundColor,
brightness: Brightness.light,
textTheme: lightTextTheme,
);
static final ThemeData darkTheme = ThemeData(
scaffoldBackgroundColor: Colors.black,
brightness: Brightness.dark,
textTheme: darkTextTheme,
);
static final TextTheme lightTextTheme = TextTheme(
title: _titleLight,
subtitle: _subTitleLight,
button: _buttonLight,
display1: _greetingLight,
display2: _searchLight,
);
static final TextTheme darkTextTheme = TextTheme(
title: _titleDark,
subtitle: _subTitleDark,
button: _buttonDark,
display1: _greetingDark,
display2: _searchDark,
);
static final TextStyle _subTitleLight = TextStyle(
color: subTitleTextColor,
fontSize: 2 * SizeConfig.textMultiplier,
height: 1.5,
);
static final TextStyle _subTitleDark = _subTitleLight.copyWith(color: Colors.white70);
}
Like textMultiplier
, imageSizeMultiplier
will be used which will scale images according to the screen size.
I
mage
can also be made responsive to a certain limit by usingAspectRatio
,BoxFit
but again it depends on the space it has to grow and shrink
Certainly, in the project, I required imageMultiplier
for Icons and not the Image
as I wanted the image to take maximum size possible because it is in Expanded
widget. Have a look at the two code snippets below.
Expanded(
flex: 3,
child: Padding(
padding: EdgeInsets.symmetric(vertical: 1 * SizeConfig.heightMultiplier),
child: Image.asset(
Images.homeImage,
fit: BoxFit.fill,
),
),
)
Expanded(
flex: 1,
child: Icon(
Icons.chevron_right,
size: 6 * SizeConfig.imageSizeMultiplier,
),
)
Expanded used as Icon parent is in Row to give equal horizontal space.
As the name suggests, heightMultiplier and widthMultiplier
can be used for making paddings, margins, Box Constraints, SizedBox, and alike widgets responsive.
Container(
constraints: BoxConstraints(minHeight: 6.5 * SizeConfig.heightMultiplier, maxHeight: 7.9 * SizeConfig.heightMultiplier),
decoration: BoxDecoration(
borderRadius: BorderRadius.vertical(
top: Radius.circular(4 * SizeConfig.heightMultiplier),
),
color: AppTheme.topBarBackgroundColor,
),
);
FittedBox(
child: Padding(
padding: EdgeInsets.only(bottom: 2 * SizeConfig.heightMultiplier),
child: Text(
Strings.welcomeScreenSubTitle,
style: Theme.of(context).textTheme.subtitle,
textAlign: TextAlign.center,
),
),
);
Some screenshots after Strategy 1
If you come from a web background, there are Media Queries that execute specific CSS based on the dimensions of the screen.
If you come from Android background you know how to create Master-Detail Layout for landscape and List Screen with navigation drawer for Portrait introduced way back in 2011–12.
Both of these use cases come to a conclusion — load different layouts for certain screen sizes and orientations.
Have a look at the responsive widget that can handle multiple layouts.
class ResponsiveWidget extends StatelessWidget {
final Widget portraitLayout;
final Widget landscapeLayout;
const ResponsiveWidget({
Key key,
@required this.portraitLayout,
this.landscapeLayout,
}) : super(key: key);
@override
Widget build(BuildContext context) {
if (SizeConfig.isPortrait && SizeConfig.isMobilePortrait) {
return portraitLayout;
} else {
return landscapeLayout;
}
}
}
This widget has two fields — portraitLayout
that is used when the device width is < 450 and orientation is portrait and landscapeLayout
that is used when the device’s orientation is landscape.
However, you can have your own criteria based on your app’s case.
Use ResponsiveWidget like below —
Stack(
children: <Widget>[
ResponsiveWidget(
portraitLayout: TopContainerPortrait(),
landscapeLayout: TopContainerLandscape(),
),
],
);
If you loved some or the other thing in the article, don’t forget to clap 👏.
#flutter #mobile-apps
1597014000
Flutter Google cross-platform UI framework has released a new version 1.20 stable.
Flutter is Google’s UI framework to make apps for Android, iOS, Web, Windows, Mac, Linux, and Fuchsia OS. Since the last 2 years, the flutter Framework has already achieved popularity among mobile developers to develop Android and iOS apps. In the last few releases, Flutter also added the support of making web applications and desktop applications.
Last month they introduced the support of the Linux desktop app that can be distributed through Canonical Snap Store(Snapcraft), this enables the developers to publish there Linux desktop app for their users and publish on Snap Store. If you want to learn how to Publish Flutter Desktop app in Snap Store that here is the tutorial.
Flutter 1.20 Framework is built on Google’s made Dart programming language that is a cross-platform language providing native performance, new UI widgets, and other more features for the developer usage.
Here are the few key points of this release:
In this release, they have got multiple performance improvements in the Dart language itself. A new improvement is to reduce the app size in the release versions of the app. Another performance improvement is to reduce junk in the display of app animation by using the warm-up phase.
If your app is junk information during the first run then the Skia Shading Language shader provides for pre-compilation as part of your app’s build. This can speed it up by more than 2x.
Added a better support of mouse cursors for web and desktop flutter app,. Now many widgets will show cursor on top of them or you can specify the type of supported cursor you want.
Autofill was already supported in native applications now its been added to the Flutter SDK. Now prefilled information stored by your OS can be used for autofill in the application. This feature will be available soon on the flutter web.
A new widget for interaction
InteractiveViewer
is a new widget design for common interactions in your app like pan, zoom drag and drop for resizing the widget. Informations on this you can check more on this API documentation where you can try this widget on the DartPad. In this release, drag-drop has more features added like you can know precisely where the drop happened and get the position.
In this new release, there are many pre-existing widgets that were updated to match the latest material guidelines, these updates include better interaction with Slider
and RangeSlider
, DatePicker
with support for date range and time picker with the new style.
pubspec.yaml
formatOther than these widget updates there is some update within the project also like in pubspec.yaml
file format. If you are a flutter plugin publisher then your old pubspec.yaml
is no longer supported to publish a plugin as the older format does not specify for which platform plugin you are making. All existing plugin will continue to work with flutter apps but you should make a plugin update as soon as possible.
Visual Studio code flutter extension got an update in this release. You get a preview of new features where you can analyze that Dev tools in your coding workspace. Enable this feature in your vs code by _dart.previewEmbeddedDevTools_
setting. Dart DevTools menu you can choose your favorite page embed on your code workspace.
The updated the Dev tools comes with the network page that enables network profiling. You can track the timings and other information like status and content type of your** network calls** within your app. You can also monitor gRPC traffic.
Pigeon is a command-line tool that will generate types of safe platform channels without adding additional dependencies. With this instead of manually matching method strings on platform channel and serializing arguments, you can invoke native class and pass nonprimitive data objects by directly calling the Dart
method.
There is still a long list of updates in the new version of Flutter 1.2 that we cannot cover in this blog. You can get more details you can visit the official site to know more. Also, you can subscribe to the Navoki newsletter to get updates on these features and upcoming new updates and lessons. In upcoming new versions, we might see more new features and improvements.
You can get more free Flutter tutorials you can follow these courses:
#dart #developers #flutter #app developed #dart devtools in visual studio code #firebase local emulator suite in flutter #flutter autofill #flutter date picker #flutter desktop linux app build and publish on snapcraft store #flutter pigeon #flutter range slider #flutter slider #flutter time picker #flutter tutorial #flutter widget #google flutter #linux #navoki #pubspec format #setup flutter desktop on windows
1644991598
The Ultimate Guide To Tik Tok Clone App With Firebase - Ep 2
In this video, I'm going to show you how to make a Cool Tik Tok App a new Instagram using Flutter,firebase and visual studio code.
In this tutorial, you will learn how to Upload a Profile Pic to Firestore Data Storage.
🚀 Nice, clean and modern TikTok Clone #App #UI made in #Flutter⚠️
Starter Project : https://github.com/Punithraaj/Flutter_Tik_Tok_Clone_App/tree/Episode1
► Timestamps
0:00 Intro 0:20
Upload Profile Screen
16:35 Image Picker
20:06 Image Cropper
24:25 Firestore Data Storage Configuration.
⚠️ IMPORTANT: If you want to learn, I strongly advise you to watch the video at a slow speed and try to follow the code and understand what is done, without having to copy the code, and then download it from GitHub.
► Social Media
GitHub: https://github.com/Punithraaj/Flutter_Tik_Tok_Clone_App.git
LinkedIn: https://www.linkedin.com/in/roaring-r...
Twitter: https://twitter.com/roaringraaj
Facebook: https://www.facebook.com/flutterdartacademy
► Previous Episode : https://youtu.be/QnL3fr-XpC4
► Playlist: https://youtube.com/playlist?list=PL6vcAuTKAaYe_9KQRsxTsFFSx78g1OluK
I hope you liked it, and don't forget to like,comment, subscribe, share this video with your friends, and star the repository on GitHub!
⭐️ Thanks for watching the video and for more updates don't forget to click on the notification.
⭐️Please comment your suggestion for my improvement.
⭐️Remember to like, subscribe, share this video, and star the repo on Github :)
Hope you enjoyed this video!
If you loved it, you can Buy me a coffee : https://www.buymeacoffee.com/roaringraaj
LIKE & SHARE & ACTIVATE THE BELL Thanks For Watching :-)
https://youtu.be/F_GgZVD4sDk
#flutter tutorial - tiktok clone with firebase #flutter challenge @tiktokclone #fluttertutorial firebase #flutter firebase #flutter pageview #morioh #flutter
1640672627
https://youtu.be/-tHUmjIkGJ4
Flutter Hotel Booking UI - Book your Stay At A New Hotel With Flutter - Ep1
#flutter #fluttertravelapp #hotelbookingui #flutter ui design
In this video, I'm going to show you how to make a Cool Hotel Booking App using Flutter and visual studio code.
In this tutorial, you will learn how to create a Splash Screen and Introduction Screen, how to implement a SmoothPageIndicator in Flutter.
🚀 Nice, clean and modern Hotel Booking #App #UI made in #Flutter
⚠️ IMPORTANT: If you want to learn, I strongly advise you to watch the video at a slow speed and try to follow the code and understand what is done, without having to copy the code, and then download it from GitHub.
► Social Media
GitHub: https://github.com/Punithraaj
LinkedIn: https://www.linkedin.com/in/roaring-r...
Twitter: https://twitter.com/roaringraaj
Facebook: https://www.facebook.com/flutterdartacademy
I hope you liked it, and don't forget to like,comment, subscribe, share this video with your friends, and star the repository on GitHub!
⭐️ Thanks for watching the video and for more updates don't forget to click on the notification.⭐️Please comment your suggestion for my improvement. ⭐️Remember to like, subscribe, share this video, and star the repo on Github :)Hope you enjoyed this video! If you loved it, you can Buy me a coffee : https://www.buymeacoffee.com/roaringraaj
#flutter riverpod #flutter travel app #appointment app flutter #morioh
1642514982
Flutter Hotel Booking UI - Book your Stay At A New Hotel - Ep3
In this video, I'm going to show you how to make a Cool Hotel Booking App using Flutter from scratch.
In this Episode , you will learn how to create a Custom Navigation Bar for Navigating between Screen.
🚀 Nice, clean and modern Hotel Booking #App #UI made in #Flutter
⚠️ IMPORTANT: If you want to learn, I strongly advise you to watch the video at a slow speed and try to follow the code and understand what is done, without having to copy the code, and then download it from GitHub.
Starter Project : https://github.com/Punithraaj/Flutter_Hotel_Booking_UI/tree/Episode-2
► Timestamps
0:00 Intro
0:15 Custom Bottom Navigation Screen
07:26 Tab Button
► Social Media
GitHub: https://github.com/Punithraaj/Flutter_Hotel_Booking_UI
LinkedIn: https://www.linkedin.com/in/roaring-r...
Twitter: https://twitter.com/roaringraaj
Facebook: https://www.facebook.com/flutterdartacademy
► Previous Episode : https://youtu.be/A0QdZPpMBb0
► Playlist: https://www.youtube.com/playlist?list=PL6vcAuTKAaYdboy1OOxnMekOEuRzHUvR6
I hope you liked it, and don't forget to like,comment, subscribe, share this video with your friends, and star the repository on GitHub!
⭐️ Thanks for watching the video and for more updates don't forget to click on the notification. ⭐️Please comment your suggestion for my improvement. ⭐️Remember to like, subscribe, share this video, and star the repo on Github :)
Hope you enjoyed this video!If you loved it, you can Buy me a coffee : https://www.buymeacoffee.com/roaringraaj
#morioh #flutter travel app #appointment app flutter #flutter #fluttertravelapp #hotelbookingui #flutter ui design #book your stay at a new hotel app #hotel booking app flutter #flutter travel ui tutorial
1644991965
Flutter Hotel Booking UI - Book your Stay At A New Hotel - Ep3
In this video, I'm going to show you how to make a Cool Hotel Booking App using Flutter from scratch.
In this Episode , you will learn how to create a Custom Navigation Bar for Navigating between Screen.
🚀 Nice, clean and modern Hotel Booking #App #UI made in #Flutter
⚠️ IMPORTANT: If you want to learn, I strongly advise you to watch the video at a slow speed and try to follow the code and understand what is done, without having to copy the code, and then download it from GitHub.
Starter Project : https://github.com/Punithraaj/Flutter_Hotel_Booking_UI/tree/Episode-2
► Timestamps
0:00 Intro
0:15 Custom Bottom Navigation Screen
07:26 Tab Button
► Social Media
GitHub: https://github.com/Punithraaj/Flutter_Hotel_Booking_UI
LinkedIn: https://www.linkedin.com/in/roaring-r...
Twitter: https://twitter.com/roaringraaj
Facebook: https://www.facebook.com/flutterdartacademy
► Previous Episode : https://youtu.be/A0QdZPpMBb0
► Playlist: https://www.youtube.com/playlist?list=PL6vcAuTKAaYdboy1OOxnMekOEuRzHUvR6
RESOURCES
Complete Hotel Booking App UI Design Tutorial: https://youtube.com/playlist?list=PL6vcAuTKAaYdboy1OOxnMekOEuRzHUvR6
Complete Tik Tok Clone App Tutorial: https://youtube.com/playlist?list=PL6vcAuTKAaYe_9KQRsxTsFFSx78g1OluK
Complete Online Books Store Flutter UI Tutorial: https://youtube.com/playlist?list=PL6vcAuTKAaYdRkc_jt08x23plwGAYiGTU
Flutter UI Tutorial: https://youtube.com/playlist?list=PL6vcAuTKAaYeKyXAwzB9JnuR5l0dOlNRh
Flutter Integration Tutorial: https://youtube.com/playlist?list=PL6vcAuTKAaYdpG5qfCjSEgugvvhqFemes
I hope you liked it, and don't forget to like,comment, subscribe, share this video with your friends, and star the repository on GitHub!
⭐️ Thanks for watching the video and for more updates don't forget to click on the notification.
⭐️Please comment your suggestion for my improvement.
⭐️Remember to like, subscribe, share this video, and star the repo on Github :)
Hope you enjoyed this video!
If you loved it, you can Buy me a coffee : https://www.buymeacoffee.com/roaringraaj
LIKE & SHARE & ACTIVATE THE BELL Thanks For Watching :-)
https://youtu.be/cCion2y7hNE
#appointment app flutter #flutter #fluttertravelapp #hotelbookingui #flutter ui design #book your stay at a new hotel app #hotel booking app flutter #flutter travel ui tutorial #morioh #flutter