Latest Added Tutorials
09-08-2020
Flutter TextFormField Phone Number Formatter
Converts phone number 00000000 to (000) 000 0000
class PhoneNumberFormatter extends TextInputFormatter {
PhoneNumberFormatter();
@override
TextEditingValue formatEditUpdate(
TextEditingValue oldValue,
TextEditingValue newValue,
) {
if (!oldValue.text.contains("(") &&
oldValue.text.length >= 10 &&
newValue.text.length != oldValue.text.length) {
return TextEditingValue(
text: "",
selection: TextSelection.collapsed(offset: 0),
);
}...Continue Reading
03-06-2020
class ApiHelper {
static const String BASE_PATH = "http://api.example.com";
static const String API_PATH = "/api";
Future<ApiResponseModel> request(String url,
{Map<String, String> queryParameters,
bearerToken = '',
isSSL = false}) async {
return _innerRequest(url, 'GET',bearerToken,isSSL);
}
Future<ApiResponseModel> _innerRequest(String url, String type,
[postParams,bearerToken = '']) async {
url = _getUrl(url);
Dio dio = _getDio(bearerToken);
try {
var response;
if(type=='GET')...Continue Reading
16-03-2020
Events
abstract class CounterEvent {}
class IncrementEvent extends CounterEvent{}
class DecrementEvent extends CounterEvent{}
Bloc Class
import 'dart:async';
import 'package:fluttertemplate/blocs/bloc.dart';
import 'counter_event.dart';
/// More Detail:
/// https://www.didierboelens.com/2018/08/reactive-programming-streams-bloc/
/// https://pub.dev/documentation/rxdart/latest/
/// https://blog.soshace.com/understanding-flutter-bloc-pattern/
class CounterBloc extends Bloc {
int _counter = 0;
final _counterStateController = StreamController<i...Continue Reading
16-03-2020
Events
abstract class CounterEvent {}
class IncrementEvent extends CounterEvent{}
class DecrementEvent extends CounterEvent{}
Bloc class
import 'dart:async';
import 'package:fluttertemplate/blocs/bloc.dart';
import 'package:rxdart/rxdart.dart';
import 'counter_event.dart';
/// More Detail:
/// https://www.didierboelens.com/2018/08/reactive-programming-streams-bloc/
/// https://pub.dev/documentation/rxdart/latest/
/// https://blog.soshace.com/understanding-flutter-bloc-pattern/
class CounterBlocRxDart extends Bloc {
int _counter = 0;
final _rep...Continue Reading
Number Increment Decrement Widget
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:kadir_alkan_kuafor/models/general_model.dart';
import 'package:kadir_alkan_kuafor/models/number_increment_decrement_model.dart';
class NumberIncrementDecrement extends StatefulWidget {
final NumberIncrementDecrementModel numberIncrementDecrementModel;
NumberIncrementDecrement({Key key, this.numberIncrementDecrementModel})
: super(key: key);
@override
StateContinue Reading