Hi Guys, Welcome to Proto Coders Point, In the article post we will discuss on 5 best programming books for beginners by which you can teach yourself and learn to think like a programmer and crack can any coding interview.
As any beginner in the Coding field, It’s very important to have a basic knowledge of coding/programming. Since there are many books that are good and available to buy from Amazon or Flipkart and this company even provides read online books for free, But selecting the right book seems to be difficult to deal with.
So Here i am with some top coding books for beginners, which all programmers must have read:
5 Best Coding Books – Programming Books for Beginners
#1. Think Like a Programmer – An Introduction to Creative Problem Solving
Anton Spraul says : The real challenge of programming isn’t learning a language’s syntax—it’s learning to creatively solve.
The Author V.Anton Spraul his main focus is on how to think like a programmmer, this unique book for coders will break down the way any programmers tends to solve coding issues. In this book there is a problem solving methods where a programmers can test their programming skill and knowlegde.
This book will help you in learning the systematic and Clean Code: Usually when beginner code any function it will work perfectly but then the same code is been sent to other programmer he might be difficult for him to understand because the code is full of messy and with no proper comments – this book Clean Code will help you to teach yourself how to write clean code.
The C Programming language book will elaborate you on the basic of procedure oriented programming and the basic fundamental of writing C programming codes.
It gives introduction on what are variables, loops and function that will give a quick start to beginner programmers.
c programming books for beginners, must read this book.
This is the most popular book on java programming, Whether you’re a java beginner or an experienced person this is the one and only book that has full details on Java course.
you can jump to learn python the hard way is you have basic knowlegde of any programming.
This book is the complete reference, it has overall information and detailed study of python so it’s the best python book and one of the best book for python for beginners to learn in-depth.
Hi Guys, Welcome to Proto Coders Point, In this flutter tutorial we will build an application to demonstrate new feature of Flutter 1.20 that is Flutter Interactive Wiewer Widget.
What is Interactive Viewer Flutter?
Recently on August 4th 2020 Flutter team have launched V1.20, that comes with awesome developement tools.
This Interactive Viewer is designed for developing simple & commonly interaction that happens into your application, such as Pan, Zooming or drag n drop events and using this widget user can easily resize the widget child.
Basically Interactive Viewer class is a widget that let’s us with the feature of pan(Drag),Zooming with 2 finger touch.
flutter 1.20 dart 2.9.0
Implementation of interactive viewer in android-studio(IDE)
So Let’s Implement it in our flutter project
Step 1: Create a new flutter project
I am using Android-Studio as my IDE to build Flutter Apps, you my make use of Android-studio or VSCode editor.
File > New > New Flutter Project
Give a name to the project as per your choose and continue.
Explanation of Flutter Interactive Viewer (Snippet Code)
Here is the basic explanation of each properties used in below snippet code.
InteractiveViewer(
boundaryMargin: EdgeInsets.all(20.0),
transformationController: transformationController,
minScale: 0.1,
maxScale: 1.6,
// You can off zooming by setting scaleEnable to false
//scaleEnabled: false,
onInteractionStart: (_)=>print("Interaction Started"),
onInteractionEnd: (details) {
setState(() {
transformationController.toScene(Offset.zero);
});
},
onInteractionUpdate: (_)=>print("Interaction Updated"),
child: ClipRRect(borderRadius: BorderRadius.circular(15),child: Image.network("https://pbs.twimg.com/profile_images/1243950916362895361/Z__-CJxz_400x400.jpg")),
)
boundrymargin: it is just to define the space or margin from all the sides of the interactive viewer child.
minScale: here minimun scale means how much a uses can zoom out the widget, here 0.1 for example means 10% scale of the widget.
maxScale: Basically the maximum size that the widget can be Zoomed in by the user.
onInteractionStart: what event should occur when user try to interact with the widget either when user try to zoom or when user try to drag the widget.
OnInteractionUpdate: what event/function should occur when user drag or zoom the widget to new view/position.
OnInteractionEnd: when user drag and drop or when user simple interaction with widget leave free the widget, what event should happens
for example: when user zoom the image and then leave it, onInteractionEnd will get triggered and event like image get auto resized back to its original position.
In above Snippet code, in child tag we have a image widget that will simply load image from internet using IMAGE URL.
Step 2: Complete code of Flutter Interactive Viewer
Then in main.dart file under lib directory of you flutter project just copy below full code and run the project.
Hi Guys, Welcome to Proto Coders Point, In this android tutorial we will create our own custom toast message in android studio.
What is Toast Message?
Some TImes Toast Messages are also called as Toast Notification.
It’s a small message that pop up at the bottom of the device screen and immediately disappears on it’s own after a delay of few seconds.
This are mostly used to show a feedback on the operation that is preformed by the user.
So, Let’s Begin Implementing of Custom Toast Message into our android project.
Step 1: Create a new project in android studio
File > New > New Project
Give a name to your project as “android custom toast” and hit the next,next finish so that android studio can build a project for you.
Step 2: Create 2 vector image in Drawable folder
As we gonna show 2 toast message i.e Smiling face icon when success toast message and a Error icon when unsuccessful message. So that we need to create 2 vector image in drawable folder
Right Click ( drawable folder ) > New > Vector Image ( select vector image and color and save it )
Step 3: Create a layout design for custom toast message
create a new layout file under res > layout and name it as custom_toast_design.xml and paste the below xml design code.
Hi Guys, Welcome to Proto Coders Point, In this Flutter tutorial we gonna add Bottom navigation bar to our flutter application, So to achieve this we will make use of Flutter Convex Bottom bar library.
if you don’t know how Convex Bottom navigation bar look like in Flutter, Check out below screenshot of the application output.
Instead, you’re switching out a over all group of content within a single page to give the appearance that the page is changing.Here is a illustration to visually describe what we’re doing. Not that the overall “scaffolding”, as Flutter calls it, stays the same and the contents within the page change.
Bottom navigation bar with 3 different page switch
Ok so now let’s begin developing flutter application with Convex Bottom bar library
offcourse you need to create a new Flutter Project, In this tutorial i m making use of Android Studio as my IDE to develop Flutter Projects.
File > New > New Flutter Project
Give a suitable name to your Flutter project and and hit next next finish.
Once the Flutter Project is ready, Flutter project will be built with some default code, just remove all those default code and copy paste below code for a quick start.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Convex Bottom Bar'),
);
}
}
class HomeMainPage extends StatefulWidget {
@override
_HomeMainPageState createState() => _HomeMainPageState();
}
class _HomeMainPageState extends State<HomeMainPage> {
@override
Widget build(BuildContext context) {
return Container(
child: Text("This is Main Page "),
);
}
}
Step 2: Add the required dependencies library
As i said at the beginning, i am going to make use of external library to add Bottom material navigation bar in our flutter project.
to add the dependencies, navigate/open pubspec.yaml file and add the following dependencies
dependencies:
flutter:
sdk: flutter
convex_bottom_bar: #add this line
after adding, just hit that pub get text on top at appears when any change is been done in pubspec.yaml file.
what this will do is, it will fetch all the required library and store into your flutter project as external library.
Step 3: Import the Convex library when required
As you have added the Bottom bar convex library dependencies now you can easily make use of that library just be importing it wherever required.
Here we have 4 tabs in Bottom bar Home, Favorites, Search, Profile, and initialActiveIndex is set to 0 that is selectedPage, and when any Tab is been Pressed onTap will get Triggred with the index value Tab that been selected and selectedPage will get changed with the index value , and hence selected Index page will be get displayed in body tag of main.dart page.
Complete flutter code
import 'package:convex_bottom_bar/convex_bottom_bar.dart';
import 'package:flutter/material.dart';
import 'Home.dart';
import 'Fav.dart';
import 'Search.dart';
import 'Profile.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Flutter Convex Bottom Bar'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int selectedPage = 0;
final _pageOptions = [Home(), Fav(),Search(), Profile()];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: _pageOptions[selectedPage],
bottomNavigationBar: ConvexAppBar(
items: [
TabItem(icon: Icons.home, title: 'Home'),
TabItem(icon: Icons.favorite, title: 'Favorites'),
TabItem(icon: Icons.search, title: 'Search'),
TabItem(icon: Icons.person, title: 'Profile'),
],
initialActiveIndex: 0,//optional, default as 0
onTap: (int i ){
setState(() {
selectedPage = i;
});
},
),// This trailing comma makes auto-formatting nicer for build methods.
);
}
}
Conclusion
In this above Flutter tutorial we have learnt how to add Botton Navigation bar in our flutter project
Hi Guys, Welcome to Proto Coders Point, In this Flutter Tutorial we gonna Learn basic of Flutter BLoC Pattern, Basically we will build a simple app that can perform Increment & Decrement operations.
FINAL RESULT
What is a Bloc?
A BLoC we can simply understand with the help of below Diagram.
Business logic Component is basically a Box where Events cames from one side & the State comes out with the required data from other side.
Check out the tutorial atricle on Introduction of Flutter Bloc pattern
Flutter is really an awesome framework because it allows fully freedom to the app developer in how to manage the state, If i say BLoC (Business Logic Component) pattern is the prefect tool that fits for Flutter application and that is the reason i am here with Flutter BLoC pattern tutorial.
Flutter BLoC Pattern Tutorial – Inc & Dec Example
So Basically in our Flutter Bloc pattern example, there are 2 kinds of events that will be performed by the used i.e 1. Increment Event2. Decrement Event.
Video Tutorial on Flutter BLoC Pattern
Step 1: Create a dart file (Event_Counter)
Now, Create a dart file inside lib folder of your flutter project & name it as
This File will handle event.
Event_Counter.dart
abstract class EventCounter{}
//abstract class to find out which Event was occurred
class IncrementEvent extends EventCounter{}
class DecrementEvent extends EventCounter{}
Step 2: Create a Flutter BLoC Class
then, Now Create a Flutter BLoC Class dart file under lib directory and name it as BlocCounter.dart
import 'dart:async';
import 'EventCounter.dart';
// async enable
class Bloc_Counter{
int _counter = 0;
//StreamCountroller handle input and output
final _counterStateController = StreamController<int>();
// Sink in Flutter can be easily stated, In Simple Words Sink = Import
StreamSink<int> get _inCounter =>_counterStateController.sink;
// Stream in Flutter can be easily stated, In Simple Words Stream = Output
Stream<int> get counter =>_counterStateController.stream;
//event controller to trigger which event has occurred
final _counterEventController = StreamController<EventCounter>();
Sink<EventCounter> get counterEventSink =>_counterEventController.sink;
Bloc_Counter(){
_counterEventController.stream.listen((_mapEventtoState));
}
void _mapEventtoState(EventCounter event){
// depending on event either increment or decrement the counter variable
if(event is IncrementEvent)
_counter++;
else
_counter--;
_inCounter.add(_counter);
}
// Dispose the Controller, Very important step, Otherwise you may get memory leak
void dispose(){
_counterStateController.close();
_counterEventController.close();
}
}
Brief information of what is going on the above Flutter Bloc pattern code.
async allows us to use Flutter Feature like StreamController, Stream, Future and Sink.
Sink in Flutter can be easily stated, In Simple Words Sink = Import.
Stream in Flutter can be easily stated, In Simple Words Stream = Output.
Event controller to trigger which event has occurred
and every Controller must be disposed when application is not in use, otherwise it may lead to memory leak.
Step 3: UI Design
Then, open main.dart file and copy paste below lines of code
Thus, your Flutter Application is ready with Flutter Bloc Feature.
Guys, if you have any confusion just check out my Project Structure below.
Conclusion
In this article we learnt How to Build and Flutter App, that can perform Increment and Decrement operation by using Flutter Business Logic Component to perform the event and change the Flutter application UI state as per .
In order to learn or understand anything about BLoC, you need to have some basic knowledge about these 4 terms in Flutter Development.
State
Event
Stream
Sink.
State: A State in the flutter app is nothing but the data your application is currently been showing. As you guys know that Flutter is a reactive framework as data changed, Application UI also gets change.
Event: An Event is an action that is detected by the application, Typically, it’s a user action like clicking on a button and some action is be performed.
Stream: A Stream can be considered as a medium through which data is transferred. Easily understanding of Stream can be assumed like a pipeline from where the water is been supplied to other ends, How water travel through pipeline like the same way data is transferred through the stream.
There comes a point where we consume or receive data that is been flowing through the stream, This is where we can call Sink
Sink: A Sink can e considered as the point where you receive or consume data from a stream.
So now you know basics of these 4 terms, now you can easily understand what is flutter BLoC.
Flutter Bloc Pattern
3 different component of Flutter BLoC Pattern
UI
BLoC
Data Provider
Here UI can interact with bloc & bloc can also do the same.
The Bloc provider can interact with the data provider for data.
What is BLoC Stands For?
A BLoC stands for Business Logical Component, A Flutter BLoC contents all the Business logic of a Application.
What is Data Provider in BLoC Pattern?
A Data Provider can be considered as your back-end i.e your database where all the users data is been stared.
How Flutter BLoC Works?
When an application is built using the Flutter BLoc pattern, whenever any data change is found in the data provider, BLoC (Business Logic Component) applies business logic to the current state & it re-creates the new state to the UI & when UI receive the new state it re-render itself to show the latest version of UI with new data that is been received from the data provider.
Let’s Understand Flutter Bloc with an Application Example
Flutter BLoC Pattern Example
Flutter BLoC Pattern Tutorial Example
Step 1: Create a new Flutter project
In my case, I am making use of the android studio as my IDE to develop the Flutter project
Create new Project File > New > New Flutter Project
Give a name to your project as “Flutter Bloc Load image Example” or anything as per your choice.
Step 2: Add Required Dependencies
Then, Open pubspec.yaml file and add below 2 dependencies
after adding this 2 dependencies now click on pub get text, What this will do is download all the required packages into your flutter project external library.
Step 3: Create a new dart file
Then, once you have added bloc dependencies, now create a new dart file under the lib directory and name it as “BlocImage.dart”
and then Copy below lines of BlocImage Code that will simply return the URL of an image.
Note:return, returns the values and also terminates the function, where a yield, returns the value but does not terminate the function.
In the above Bloc code I have set initialState to an image URL that has Not to Image Message, and when the user clicks on Button event mapEventToState gets trigged and original image will get displayed on the screen.
So In Above lines of code i have wrapped MyHomePage widget class in BloCprovider, what the BLocProvider will do is, it will pass the BlocImage instance to its child MyHomePage.
So to refer BlocImage in your MyHomePage i have created a final variable as you may see in above complete or below snippet code.
final _blocimage = BlocProvider.of<BlocImage>(context);
on Button Click Event new data will be fetched from the Flutter BLoC pattern