Posts

ActionChip Class

  import "package:flutter/material.dart" ; void main () { runApp( MyApp ()) ; } class MyApp extends StatelessWidget { MyApp({ super .key}) ; @override Widget build (BuildContext context) { return MaterialApp ( title: "ActionChip Class" , debugShowCheckedModeBanner: false, theme: ThemeData ( primarySwatch: Colors. grey , ) , home: ActionChipDemo () , ) ; } } class ActionChipDemo extends StatefulWidget { ActionChipDemo({ super .key}) ; @override State<ActionChipDemo> createState () { return ActionChipDemoState () ; } } class ActionChipDemoState extends State<ActionChipDemo> { bool favourite = false; @override Widget build (BuildContext context) { return Scaffold ( appBar: AppBar ( title: const Text ( "ActionChip Class" ) , centerTitle: true, backgroundColor: Colors. grey , ) , body: Center ( child: ActionChip ( ...

Autocomplete Class

import "package:flutter/material.dart" ; void main () { runApp( const MyApp ()) ; } class MyApp extends StatelessWidget { const MyApp({ super .key}) ; @override Widget build (BuildContext context) { return MaterialApp ( title: "Autocomplete Class Practice" , debugShowCheckedModeBanner: false, theme: ThemeData ( primarySwatch: Colors. grey , ) , home: const AutoCompletePractice () , ) ; } } class AutoCompletePractice extends StatelessWidget { const AutoCompletePractice({ super .key}) ; static const List<String> suggestionsList = [ "toy" , "Toy" , "apple" , "Apple" , "banana" , "Banana" , "mango" , "Mango" , "cat" , "Cat" , "play" , "Play" , "game" , "Game" , "microsoft" , "Microsoft" , "google" , "Google" , "zebr...

API Calling with Dio Example with Model Class

  import "package:firebase/self_practice/display_product.dart" ; import "package:firebase/self_practice/productModel.dart" ; import "package:flutter/material.dart" ; import "package:get/get.dart" ; import "package:dio/dio.dart" ; void main () { runApp( MyApp ()) ; } class MyApp extends StatelessWidget { MyApp({ super .key}) ; @override Widget build (BuildContext context) { return GetMaterialApp ( title: "API Calling with DIO" , debugShowCheckedModeBanner: false, theme: ThemeData ( primarySwatch: Colors. grey , ) , home: ApiCall () , ) ; } } class ApiCall extends StatelessWidget { ApiCall({ super .key}) ; Future<List<Product>> apiCalling () async { var response = await Dio ().get( "https://fakestoreapi.com/products" ) ; final List< dynamic > responseData = response. data ; List<Product> products = responseData.map((json) { ...

CheckboxListTile Dynamic

  import "package:flutter/material.dart" ; void main () { runApp( MyApp ()) ; } class MyApp extends StatelessWidget { MyApp({ super .key}) ; @override Widget build (BuildContext context) { return MaterialApp ( title: "Dynamic checkboxListTile" , debugShowCheckedModeBanner: false, theme: ThemeData ( primarySwatch: Colors. grey , ) , home: DynamicTile () , ) ; } } class DynamicTile extends StatefulWidget { DynamicTile({ super .key}) ; @override State<DynamicTile> createState () { return DynamicTileState () ; } } class DynamicTileState extends State<DynamicTile> { List<Map> categories = [ { "name" : "Swimming" , "isChecked" : false } , { "name" : "Cycling" , "isChecked" : false } , { "name" : "Tennis" , "isChecked" : false } , { "name" : "Boxing" , "is...

CheckboxListTile

  import "package:flutter/material.dart" ; void main () { runApp( const MyApp ()) ; } class MyApp extends StatelessWidget { const MyApp({ super .key}) ; @override Widget build (BuildContext context) { return MaterialApp ( title: "CheckBoxListTile" , debugShowCheckedModeBanner: false, theme: ThemeData ( primarySwatch: Colors. grey , ) , home: const CheckPractice () , ) ; } } class CheckPractice extends StatefulWidget { const CheckPractice({ super .key}) ; @override State<CheckPractice> createState () => _CheckPracticeState () ; } class _CheckPracticeState extends State<CheckPractice> { /// value set to false bool _value1 = false; @override Widget build (BuildContext context) { return Scaffold ( appBar: AppBar ( title: const Text ( "CheckBoxListTile" ) , centerTitle: true, backgroundColor: Colors. grey , ) , body: Center ( ...

Get CLI Commands in GetX

  /// Get CLI tool /// ================== /// Make flutter development easy with GetX and Get CLI tool /// /// 1. Install /// ================== /// flutter pub global activate get_cli /// /// 2. Create project /// ================== /// get create project /// /// a. If no project name is specified it will take the folder name as project name /// b. get create project:get_cli_project [project with name] /// c. get create project:"get cli project" [project name with space] /// /// 3. To create the structure /// =========================== /// get init /// /// 4. Create a page /// =========================== /// get create a page:page_name [will create controller, view and binding] /// /// 5. Create Controller /// =========================== /// a. get create controller:controllerName [By default in home folder] /// b. get create controller:controllerName on folderName /// /// 6. Create View /// ====================================== /// a. get create view:ViewName [By defaul...

DialogBox in GetX

  import "package:flutter/material.dart" ; import "package:get/get.dart" ; void main () { runApp( MyApp ()) ; } class MyApp extends StatelessWidget { MyApp({ super .key}) ; @override Widget build (BuildContext context) { return GetMaterialApp ( title: "Dialog Box" , debugShowCheckedModeBanner: false, theme: ThemeData ( primarySwatch: Colors. blue , ) , home: PracticeDialog () , ) ; } } class PracticeDialog extends StatelessWidget { PracticeDialog({ super .key}) ; @override Widget build (BuildContext context) { return Scaffold ( appBar: AppBar ( title: const Text ( "DialogBox in GetX" ) , centerTitle: true, backgroundColor: Colors. grey , ) , body: Center ( child: Column ( mainAxisAlignment: MainAxisAlignment. center , crossAxisAlignment: CrossAxisAlignment. center , children: <Widget>[ ...