List of Switch state

Switch is one of the commonly used widgets that is used to ON or OFF a single setting. It has two states either ON or OFF. It has onChanged property to maintain states. The true value will make the switch ON and OFF when the switch is OFF.

Here we are maintaining the state of the list of switches.

Our final app looks as follows:

Final Output

Let’s Dig In

First, we create the listitems.


toggleSwitch is responsible for changing the state of the isSelected value.

Then we create our homepage. Here we create the list of MyListViewItems.



Lastly, this is what our main.dart file looks like.



Shimmer Loading in Flutter

 This article will help you to get started with the shimmer effect when loading with state management using a provider



The final app looks as follows:



Provider

Provider is built by the community for effective state management. Although it is not developed by Google, they encourage using it. It is easier to use and manage which is basically a wrapper around the Inherited Widgets.

Shimmer

Shimmer is a loading effect that is used to add beautiful animation when the data is loading from the server. In simple words, it is a loader like the Circular Progress Indicator available in the Flutter framework.



Click FULL CODE for code: 


Collapsible App Bar Flutter

 AppBar widget is one of the most used and integral part of any mobile app which is used to display important information such as page title, tabs, logo, and action icons that can be used for various purposes like navigation and many more.

Scrolling App bar is one of the special abilities that is widely used in modern applications.

Also, we are going to use the CarouselSlider.

Note: The image of products used in this application are from Nykaa.

First, we are going to discuss the widgets we are going to use in this application.

NestedScrollView

It is a ScrollView inside which other scrolling views can be used , with their scroll positions being intrinsically linked. The most common use case for this widget is a scrollable view with a flexible SliverAppBar containing a TabBar in the header (built by headerSliverBuilder, and with a TabBarView in the body, such that the scrollable view’s contents vary based on which tab is visible.

SliverAppBar

SliverAppBar is the material widget in flutter which provides ability of scrollable or collapsible AppBar. It also allows us the create the floating app bar effect. It gets expanded and collapses when the AppBar is scrolled up and scrolled down respectively.

CarouselSlider

Carousel Slider is one of the most popular image sliders used nowadays in most apps. These Carousel Sliders are mostly seen in various eCommerce sites such as Amazon, Flipkart, Myntra, and many more. Displaying the images in a slider gives an attractive User Experience. As these sliders are automated you can get to see various types of images and content in them.



Learn more on this link.





Live example:




Theme Switcher in flutter

 In the field of application development, switching themes is one of the trending features. Changing the theme can reduce the user’s eye strain and also the battery life.

Here, we are going to learn how to develop an application that can change the themes dynamically.

Get full code: Github




    Live working example :



In this project, we are going to use two packages Provider and SharedPreferences.

  • Provider: It is one of the famous packages that is used for dependency injection and state management.
  • SharedPreferences: Shared Preferences allow us to store the minimal amount of primitive data as key/value pairs in a file on the device. Here we use it to store the current theme so that the user gets the same after closing and returning back to the application.

We can achieve this in two ways: one by adding a custom option and the other by automatically switching the theme based on the system settings.

In Flutter, we can change the theme throughout the app with the help of ThemeData in MaterialApp constructor. The default theme will be shared throughout the app when no theme is provided.

MaterialApp(
theme: ThemeData( ... ), // to declare the theme to throughout the application
);

ThemeData is used to configure the appearance of the entire app. It consists of a large number of properties to declare the theme in our app.

ThemeData.dark() is responsible to provide the dart theme across the application.

MaterialApp(
theme: ThemeData.dark(), // default dark the theme
);
Dark theme

ThemeData.light() gives the Light blue theme, which is a default theme for every flutter application.

Light theme

We can also change the primaryColor of the theme. We can obtain as follows:

MaterialApp(
theme: ThemeData(
brightness: Brightness.light,
primaryColor: Colors.green,
primarySwatch: Colors.green
),);
Light theme color

Date picker in flutter


Date Picker is one of the most-used widgets in mobile applications and also in web apps too. In this article, we are going to create a simple working example of how to create a date picker and get the date.

Our final app will function as follows:

https://bit.ly/3chaqdv 

The working example of the application.




Learn in Video




First, we create a new file named homepage.dart inside the lib folder. As in the gif above, we first need to have a text field. When clicking a text field, the date picker dialog is opened where we choose the date.

Then we create the date picker.


  • initialDate: Here we give today’s date. Today’s date will get highlighted when the date picker is shown.
  • lastDate: Here we provide how far our calendar shows the year's data.
  • firstDate: Here we need to provide how much back the date are shown. If we have to disable users to exclude dates before today we need to provide today’s date as.

With this, we can show the date picker and pick the date. We can also format the date we picked from the date picker.  





Here we have formatted the date as yyyy-MM-dd . You can achieve more formatting by following this link.

After selecting the date and formatting we set our dateController with the picked date as:

setState(() { 
dateController.text = formattedDate;
});

Let’s get connected

We can be friends. Find on FacebookLinkedinGithub, and Instagram.

Conclusion

I hope this article is helpful to you and you learned new things. I have used various things in this article that might be new for some of you.

If you learned something new or want to suggest something then please let me know in the comment.

Also, follow to get updated on exciting articles and projects.

Learning by sharing gives a great impact on the learning process and makes the community bigger and bigger.

Sharing is a magnet that attracts other enthusiasts toward you.

Hence, let’s take a small step toward making our learning community bigger.

Share this article with your friends or tweet about the article if you loved it.

Features of Windows 10

Windows 10 is upon us at long last.  “The Next Chapter” event played host to Microsoft showing off several key new features for its upcoming operating system. It’s fair to say this presentation was not a dull affair. Microsoft went through a number of presentations that ranged from the predictable (a new browser), to the insane (a new holographic platform).
Microsoft clearly used the event to distance itself from its current, safe and frankly boring image, as a white-collar business software company. The Microsoft and Windows 10 of the future is one that is cooler, more ambitious, and a whole lot more crazy than  anyone predicted. This is a good thing too.Whether you've updraded or not, here are the best 10 features of the upcoming operating system.


It’s Free

One of the biggest new developments in the Windows 10 story is that it will be completely free to upgrade. Microsoft made this announcement at its January event in Redmond. The firm has said it will be available at no charge for the first year (although it may end up extending that) for Windows 8.1 and Windows Phone 8.1 users.

Windows Holographic and HoloLens



The biggest surprise of the night came in the shape (literally) of Windows Holographic. The software, which is built into Windows 10, allows developers to create virtual 3D environments which can be displayed to the user via an augmented reality headset, dubbed HoloLens.

Microsoft gave potential use cases of space scientists exploring a virtual Martian landscape, totally immersive gaming, or architects and interior designers planning and visualising construction and décor.

In an additional twist, a related piece of software, HoloStudio, will let users create a 3D, holographic model and then use a 3D printer to create it in real life.

The whole system will be available within the Windows 10 timeframe as well, the company claimed. We look forward to seeing how this slightly surreal technology translates into real life.

Start Menu

As we knew prior to the January briefing, Windows 10 will mark the return of the much loved Start Menu. In the latest build shown, it has some updated graphics and can optionally go full-screen. Half of the menu looks pretty much like it did in Windows 7 but there's the obvious addition of Live Tiles.

Cortana



As has been expected, Microsoft's virtual personal assistant, Cortana, is an integral part of Windows 10. According to Joe Belfiore, corporate VP of the Operating Systems Group in Microsoft, Cortana is able to learn about users over time, bringing together everything she knows about them to deliver reminders and suggestions in the Calendar, taskbar and new Spartan browser.

As she's constantly connected to, and trawling the internet, she can deliver additional information on web
pages. Belfiore gave the example of a restaurant, where Cortana automatically delivered information on the venue's menu, opening hours, and directions from his location. How useful (or annoying) this will be remains to be seen - we weren't the only ones to feel shades of Clippy in the sassy AI's attitude and functionality.


Universal apps

The news of Universal apps is good news for anyone using more than one Windows device. A bundle of apps including Photos, Videos, Music, Maps, People & Messaging and Mail & Calendar (and presumably more in the future) will look and feel the same across different devices and screen sizes. The data will also be saved and sync automatically via OneDrive.

Surface Hub

Microsoft really wanted to remind us that Windows 10 isn’t all about improving useability for consumers, it’s also a very serious productivity too. So, to convey this properly, it went and created a whopping big tablet to hang on a boardroom wall, the Surface Hub.

Available in two sizes, 55in and 84in, and with a 4K display, the Surface Hub is seemingly the ultimate computer and screen for the boardroom.

Coming with custom versions of Skype for Business and OneNote, Windows 10 makes sure that the Surface Hub’s cameras, sensors and microphones all work perfectly together.

You can also use an included smart pen to draw on the screen like a whiteboard, and you can share screens and interact with others viewing on computers and Surface Hubs too.

It’s an impressive piece of business kit, and despite being incredibly corporate and functional, something about it screams boardroom of the future.
Windows Phone


It looks like the death of Windows Phone is near as Windows 10 will arrive on Windows Phone devices when it launches. Microsoft has given no other name for it running on smart phone and small tablets.

In general it looks much the same as Windows Phone 8 but with tweaks. As mentioned above, Action Center is synced with your other devices and the app menu will show recently installed apps at the top. Two cool new additions are the ability to float the keyboard around the screen and reply to message notifications in-line.

Enhancements

Thanks to the Windows Insider program, Microsoft is making changes suggested by Windows users around the globe. Since Windows 10 runs across all devices, the OS will have unified settings. That means the end of separate control panel and PC settings. There's also the Action Center now provides notifications and is synchronised across devices.  

Edge browser

Microsoft's new web browser is called Edge, formally 'Project Spartan' and will replace Internet Explorer in Windows 10. It's been built with 'interoperability' in mind, according to Microsoft. Features include a reading mode and the ability to annotate, either with a keyboard, pen or a finger. There's also integration with Cortana to provide additional information – for example, when you're on a web page for a restaurant Cortana will make a booking and display information such as opening times.