1558152530
In this article, I’ll quickly go over what Flutter Create is and how you can build a Flutter app for it.
I’ve built a quotes generator app for Flutter Create, since it’s simple, fun to build and tickles your funny bone. More importantly, it doesn’t require a lot of code, which is a primary requisite for a Flutter Create submission.
But first, let’s talk about Flutter Create…
For those of you who don’t know what Flutter Create is, it is a competition by Google where developers are required to build a Flutter app that has Dart code that doesn’t exceed 5,120 bytes.
The submissions are judged by:
Winners get to take away a few exciting prizes but that’s really not what we are focusing on in this article.
You can read more about the rules and guidelines for Flutter Create here.
Now, let’s get started with how I built my app for this contest!
The app that I built was based on a REST API provided by Andrew Jazbec, that provides a random bunch of quotes by Kanye West. 👻
Since the contest requires us to write very minimal code, I decided to go with the idea of building a Flutter app that shows random Kanye West quotes since I found it humorous and cheeky. Who wouldn’t love quotes from Yeezy? 😜
I also decided to add an About screen, because…why not? 🕶
But I also wanted to design the app well, since that also matters for the contest, which is why I included custom fonts and a set of gradients in the app.
I also designed an app icon for this using Figma, and I’ll go over how to change app icons for iOS and Android devices easily later in this article.
Here’s what the app looks like:
Before I began with the main.dart
file, I first wrote the data class for the quote object in the quote.dart
file:
class Quote {
final String quote;
final String id;
Quote.fromJson(Map<String, dynamic> json)
: quote = json['quote'],
id = json['id'];
}
quote.dart
Each quote object has a unique ID and the quote string itself.
Keep in mind it’s important to keep your code minimal, which is why I’ve only defined the things that I’ll absolutely need here, one of which is the factory for creating a quote.
Here’s my call to get a quote from the API:
Future<void> getQuote() async {
String baseUrl = 'http://api.kanye.rest/';
try {
http.Response response = await http.get(baseUrl);
var myQuote = Quote.fromJson(jsonDecode(response.body));
setState(() {
_quote = myQuote.quote;
_gradientColors.shuffle(_random);
_colorOne = _gradientColors[0];
_colorTwo = _gradientColors[1];
});
} catch (e) {
return;
}
}
api_call.dart
Since this article is more about Flutter Create and building an app for the contest, I won’t be going over how I built the app step-by-step.
Here’s the code for main.dart
:
import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:convert';
import 'dart:math';
import 'package:http/http.dart' as http;
import 'about_screen.dart';
import 'quote.dart';
void main() => runApp(KutInApp());
class KutInApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Kut In',
theme: ThemeData(
fontFamily: 'Imperator',
textTheme: Theme.of(context).textTheme.apply(bodyColor: Colors.white),
),
home: HomeScreen(),
);
}
}
class HomeScreen extends StatefulWidget {
@override
_HomeScreenState createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
String _quote;
List<Color> _gradientColors = [
const Color(0xfff44336),
const Color(0xffba000d),
const Color(0xff9c27b0),
const Color(0xff6a0080),
const Color(0xff2196f3),
const Color(0xff0069c0),
const Color(0xfffdd835),
const Color(0xffc6a700)
];
final _random = Random();
Color _colorOne, _colorTwo;
Future<void> getQuote() async {
String baseUrl = 'http://api.kanye.rest/';
try {
http.Response response = await http.get(baseUrl);
var myQuote = Quote.fromJson(jsonDecode(response.body));
setState(() {
_quote = myQuote.quote;
_gradientColors.shuffle(_random);
_colorOne = _gradientColors[0];
_colorTwo = _gradientColors[1];
});
} catch (e) {}
}
void _getNewQuote() {
setState(() {
_quote = null;
});
getQuote();
}
@override
void initState() {
super.initState();
getQuote();
_gradientColors.shuffle(_random);
_colorOne = _gradientColors[0];
_colorTwo = _gradientColors[1];
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(colors: [_colorOne, _colorTwo]),
),
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Center(
child: Column(
children: <Widget>[
Stack(
children: <Widget>[
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Text('KUT IN'),
),
),
Align(
alignment: Alignment.centerRight,
child: IconButton(
icon: Icon(Icons.info, color: Colors.white),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AboutScreen()
));
},
),
),
],
),
Expanded(
child: Align(
alignment: Alignment.center,
child: _quote != null
? Text('$_quote',
style: TextStyle(
fontSize: 34.0,
height: 1.25,
))
: CircularProgressIndicator(),
),
),
Text('- Kanye West'),
],
),
),
),
),
floatingActionButton: FloatingActionButton(onPressed: _getNewQuote, child: Icon(Icons.refresh)),
);
}
}
Psst! The size of Dart files for this entire project? 5102 bytes.
To check the size of the Dart files in your project, just type in the following command in a terminal that’s open in your root project folder:
find . -name "*.dart" | xargs cat | wc -c
If you’re using IntelliJ or Visual Studio Code, you can just use the Terminal option available in these IDEs to run the command in the root project folder.
“Is it okay if I have too many images/fonts/assets/packages?”
Yes, that should be fine. As the contest rules state, the only files whose size matter is the Dart files in your project. Only they are measured and they need to be less than 5,120 bytes in size combined.
So feel free to go ahead and include packages, custom fonts, images and other assets in your Flutter app!
test.dart
file, unnecessary commas and duplicate theming code. But do not forgo proper indenting and formatting, since the code quality matters as well.pubspec.yaml
file.4. For my app, I designed an app icon of resolution 512x512 in Figma, a simple design tool that quickly lets you make app mockups and icons. After adding my app icon to the assets folder, I added a neat little package called [flutter_launcher_icons](https://pub.dartlang.org/packages/flutter_launcher_icons)
to auto-generate app icons for both Android and iOS platforms using my designed icon.
5. Then run the following command to clean up any unneeded build files that may have been generated by Flutter:
flutter clean
Go to the official Flutter Create website, click on the Submit your app button and upload your ZIP file via the form along with a few other details to finalise your submission! 😄
Note: You can only submit one app but you can make changes to your project and re-upload a new ZIP file, as long as you do it before April 7th!
The winners will be announced around April 25th online and also in Google I/O 2019. So what are you waiting for? Get started with Flutter today and build a minimal app before the contest ends! 😉
#ios #mobile-apps #swift #flutter
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
1598396940
Flutter is an open-source UI toolkit for mobile developers, so they can use it to build native-looking** Android and iOS** applications from the same code base for both platforms. Flutter is also working to make Flutter apps for Web, PWA (progressive Web-App) and Desktop platform (Windows,macOS,Linux).
Flutter was officially released in December 2018. Since then, it has gone a much stronger flutter community.
There has been much increase in flutter developers, flutter packages, youtube tutorials, blogs, flutter examples apps, official and private events, and more. Flutter is now on top software repos based and trending on GitHub.
What is Flutter? this question comes to many new developer’s mind.
Flutter means flying wings quickly, and lightly but obviously, this doesn’t apply in our SDK.
So Flutter was one of the companies that were acquired by **Google **for around $40 million. That company was based on providing gesture detection and recognition from a standard webcam. But later when the Flutter was going to release in alpha version for developer it’s name was Sky, but since Google already owned Flutter name, so they rename it to Flutter.
Flutter is used in many startup companies nowadays, and even some MNCs are also adopting Flutter as a mobile development framework. Many top famous companies are using their apps in Flutter. Some of them here are
and many more other apps. Mobile development companies also adopted Flutter as a service for their clients. Even I was one of them who developed flutter apps as a freelancer and later as an IT company for mobile apps.
#dart #flutter #uncategorized #flutter framework #flutter jobs #flutter language #flutter meaning #flutter meaning in hindi #google flutter #how does flutter work #what is flutter
1591643580
Recently Adobe XD releases a new version of the plugin that you can use to export designs directly into flutter widgets or screens. Yes, you read it right, now you can make and export your favorite design in Adobe XD and export all the design in the widget form or as a full-screen design, this can save you a lot of time required in designing.
What we will do?
I will make a simple design of a dialogue box with a card design with text over it as shown below. After you complete this exercise you can experiment with the UI. You can make your own components or import UI kits available with the Adobe XD.
#developers #flutter #adobe xd design export to flutter #adobe xd flutter code #adobe xd flutter code generator - plugin #adobe xd flutter plugin #adobe xd flutter plugin tutorial #adobe xd plugins #adobe xd to flutter #adobe xd tutorial #codepen for flutter.
1602147600
As the new decade dawns upon us, a slew of technologies has been making a lot of noise to grab the developers’ attention. While native app development is going strong, the trade winds are now blowing towards going cross-platform.
Adobe PhoneGap, React Native, Xamarin and Ionic are all leaving no stone unturned to be the undefeated champion of cross-platform development. Still, Google’s Flutter is all set to take them all on at once.
There are a tonne of resources available online to learn about Flutter, and you can start with this step by step flutter guide.
With reduced code development time, increased time-to-market speed, near-native performance, and a bevy of advantages under its hood, Flutter is set to dominate the market this decade.
Before we take a look at trends making the Flutter race ahead in 2020, let us do a quick recap of what Flutter is, for those who have been living under a rock.
#flutter #flutter-for-mobile-app #flutter-app-development #mobile-app-development #flutter-trends #software-development #advantages-of-flutter-mobile #pros-and-cons-of-flutter
1599861600
If you are here and a beginner, that means you want to learn everything about making an API request using Dart in Flutter, then you are in the right place for the HTTP tutorial. So without wasting any time, let’s start with this flutter tutorial. We will cover the essential topics required to work with the HTTP request in Dart.
Rest APIs are a way to fetch data from the internet in flutter or communicate the server from the app and get some essential information from your server to the app. This information can be regarding your app’s data, user’s data, or any data you want to share globally from your app to all of your users.
This HTTP request fetches in a unique JSON format, and then the information is fetched from the JSON and put in the UI of the app.
Every programming language has a way of some internet connectivity i.e, use this rest API developed on the server and fetch data from the internet. To use this request feature, we have to add HTTP package in flutter, add this flutter package add in your project to use the http
feature. Add this HTTP package to your pubspec.yaml
, and run a command in terminal :
flutter packages get
#dart #flutter #async await #async function #cancel http api request in flutter #fetch data from the internet #flutter cancel future #flutter get request example #flutter post request example #future of flutter #http tutorial