Skip to content

Instantly share code, notes, and snippets.

View Blasanka's full-sized avatar
🚀
Flutter dev

B Liyanage Asanka Blasanka

🚀
Flutter dev
View GitHub Profile
@Blasanka
Blasanka / main.dart
Last active July 18, 2018 15:10
This is a simple splash screen created without using any images and using Linear gradients for background and Text widget for logo to demonstrate basic of flutter.
import 'package:flutter/material.dart';
import 'package:flutter_quiz/simple_splash.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
@Blasanka
Blasanka / main.dart
Last active December 10, 2018 14:12
This is a SplashScreen created using flutter framework. Note: does not contain how to respond to different screen sizes: for that read this gist: https://gist.github.com/Blasanka/39b7a78dee922ac681a8af73568d2b1a , For more info go to: slcoderlk.blogspot.com
/*
First create a folder inside root directory called *assets* then inside it create another two folders called images and fonts.
Then add your fonts and images(background with logo)
*/
import 'package:flutter/material.dart';
import 'package:splashscreen_demo/splashscreen.dart';
@Blasanka
Blasanka / inherited_widget.dart
Created June 15, 2018 16:01
A simple InheritedWidget example. This code snippet demonstrate how to change the state of a widget class that is in other side(somewhere else) in the widget tree.
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: MyApp(),
),
);
}
@Blasanka
Blasanka / tabbar.dart
Created June 15, 2018 15:59
Minimum TabBar example in FLutter
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(
home: new TabBarDemo(),
));
}
class TabBarDemo extends StatelessWidget {
@override
@Blasanka
Blasanka / pubspec.yaml
Created June 15, 2018 04:52
This yaml file for the image_carousel_pro.dart file
name: image_carousel_app
description: A new Flutter project.
dependencies:
flutter:
sdk: flutter
carousel_pro: ^0.0.1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
@Blasanka
Blasanka / image_carousel_pro.dart
Last active October 16, 2019 23:20
This is a code snippet to elaborate how to use image carousel pro package with dot indicator. You can find the package here: https://pub.dartlang.org/packages/carousel_pro. Note: there are so many image carousel packages that you can try, I have chosen this because I dont want to separately add dot indicator by the time I'm creating this snippet.
@Blasanka
Blasanka / carousel_in_flutter.dart
Last active June 6, 2018 09:10
We can create our own image carousel in dart and flutter but for this code snippet, I have used carousel package. You can find it here: https://pub.dartlang.org/packages/carousel. Note: there are so many image carousel packages in pub.dart and in this one you dont have dot indicator(by the time I'm creating this snippet). If you want dot indicat…
@Blasanka
Blasanka / pass_values_to_state_class.dart
Created May 20, 2018 14:57
Pass stateful class values to State class without passing through constructor.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Demo',
home: MyHomePage('John', 'Morison'),
@Blasanka
Blasanka / infinite_pageview.dart
Last active November 25, 2019 17:30
This is a example source code for infinite pageview in flutter. Read the tutorial here: https://slcoderlk.blogspot.com/2018/05/motiv-quote-app-pageview-for-swipe.html
import 'package:flutter/material.dart';
void main() => runApp(LimeApp());
class LimeApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Lime',
theme: ThemeData(
import 'package:flutter/material.dart';
import 'package:motivational_quote_app/disney_page.dart';
import 'package:motivational_quote_app/home_page.dart';
import 'package:motivational_quote_app/lennon_page.dart';
void main() => runApp(new QuoteApp());
class QuoteApp extends StatelessWidget {
List<Widget> pages = [HomePage(), DisneyPage(), LennonPage()];
@override