Posts

Showing posts from January, 2024

Checkbox 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: "CheckBox Class Practice" , debugShowCheckedModeBanner: false, theme: ThemeData ( primarySwatch: Colors. grey , ) , home: const CheckBoxPractice () , ) ; } } class CheckBoxPractice extends StatefulWidget { const CheckBoxPractice({ super .key}) ; @override State<CheckBoxPractice> createState () { return CheckBoxPracticeState () ; } } class CheckBoxPracticeState extends State<CheckBoxPractice> { bool _checkbox = false; bool _checkbox2 = false; bool _checkboxListTile = false; bool _checkboxListTile2 = false; bool _checkboxListTile3 = false; bool _checkboxListTile4 = false; bool _checkboxListTile5 = false; @override Widget build (BuildContext cont...

Radio Button 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: "RadioButton Class" , debugShowCheckedModeBanner: false, theme: ThemeData ( primarySwatch: Colors. grey , ) , home: const RadioPractice () , ) ; } } class RadioPractice extends StatefulWidget { const RadioPractice({ super .key}) ; @override State<RadioPractice> createState () { return RadioPracticeState () ; } } class RadioPracticeState extends State<RadioPractice> { int selectedOption = 0 ; int selectedOption2 = 0 ; @override Widget build (BuildContext context) { return Scaffold ( appBar: AppBar ( title: const Text ( "RadioButton Practice" ) , centerTitle: true, backgroundColor: Colors. grey , ) , b...

CupertinoTabBar Class

  import "package:flutter/cupertino.dart" ; void main () { runApp( const MyApp ()) ; } class MyApp extends StatelessWidget { const MyApp({ super .key}) ; @override Widget build (BuildContext context) { return CupertinoApp ( title: "CupertinoTabBar Class" , debugShowCheckedModeBanner: false, theme: CupertinoThemeData ( brightness: Brightness. light , ) , home: CupertinoTabBarExample () , ) ; } } class CupertinoTabBarExample extends StatelessWidget { const CupertinoTabBarExample({ super .key}) ; @override Widget build (BuildContext context) { return CupertinoTabScaffold ( tabBar: CupertinoTabBar ( items: const <BottomNavigationBarItem>[ BottomNavigationBarItem ( icon: Icon (CupertinoIcons. star_fill ) , label: "Favorites" , ) , BottomNavigationBarItem ( icon: Icon (CupertinoIcons. clock_solid ) , ...

Divider 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: "Divider Class" , debugShowCheckedModeBanner: false, theme: ThemeData ( primarySwatch: Colors. grey , ) , home: const DividerExample () , ) ; } } class DividerExample extends StatelessWidget { const DividerExample({ super .key}) ; @override Widget build (BuildContext context) { return Scaffold ( appBar: AppBar ( title: const Text ( "Divider Class" ) , centerTitle: true, backgroundColor: Colors. grey , ) , body: Center ( child: Column ( children: <Widget>[ Expanded ( child: Card ( color: Colors. grey . shade200 , child: const SizedBox . expand ()...

ActionChoiceChip 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: "ActionChoiceChip Class" , debugShowCheckedModeBanner: false, theme: ThemeData ( colorSchemeSeed: const Color ( 0xff6750a4 ) , ) , home: const ActionChipExample () , ) ; } } class ActionChipExample extends StatefulWidget { const ActionChipExample({ super .key}) ; @override State<ActionChipExample> createState () { return ActionChipExampleState () ; } } class ActionChipExampleState extends State<ActionChipExample> { int? _value = 1 ; @override Widget build (BuildContext context) { final TextTheme textTheme = Theme. of (context). textTheme ; return Scaffold ( appBar: AppBar ( title: const Text ( "ActionChoiceChip Example" ) ,...

ListView ListTile

  import "package:flutter/material.dart" ; /// EXAMPLE 1 // void main() // { // runApp(MyApp()); // } // class MyApp extends StatelessWidget // { // MyApp({super.key}); // // @override // Widget build(BuildContext context) { // return MaterialApp( // title: "ListView ListTile", // debugShowCheckedModeBanner: false, // theme: ThemeData( // primarySwatch: Colors.brown, // ), // home: ListDemo(), // ); // } // } // // class ListDemo extends StatelessWidget { // ListDemo({super.key}); // // @override // Widget build(BuildContext context) { // return Scaffold( // appBar: AppBar( // title: const Text("ListView"), // centerTitle: true, // ), // body: Center( // child: ListView( // children: <Widget>[ // ListTile( // leading: Icon(Icons.account_box), // title: Text("Account Box"), // ...

GridView List Generate

  import "package:flutter/material.dart" ; void main () { runApp( MyApp ()) ; } class MyApp extends StatelessWidget { MyApp({ super .key}) ; @override Widget build (BuildContext context) { return MaterialApp ( title: "GridView" , debugShowCheckedModeBanner: false, theme: ThemeData ( primarySwatch: Colors. cyan , ) , home: GridDemo () , ) ; } } class GridDemo extends StatefulWidget { GridDemo({ super .key}) ; @override State<GridDemo> createState () { return GridDemoState () ; } } class GridDemoState extends State<GridDemo> { var arrColors = [ "Yellow" , "Pink" , "Black" , "White" , "Orange" , "Teal" , "Blue" , "Green" , "LightBlue" , "Dark Black" , "cyan" , "Purple" , "deepPurple" ] ; @override Widget build (BuildContext context) { ...

Horizontal ListView

  import "package:flutter/material.dart" ; /// EXAMPLE 1 // void main() // { // runApp(MyApp()); // } // class MyApp extends StatelessWidget { // MyApp({super.key}); // // @override // Widget build(BuildContext context) { // return MaterialApp( // title: "Horizontal ListView", // debugShowCheckedModeBanner: false, // theme: ThemeData( // primarySwatch: Colors.grey, // ), // home: HorizontalDemo(), // ); // } // } // class HorizontalDemo extends StatelessWidget { // HorizontalDemo({super.key}); // // @override // Widget build(BuildContext context) { // return Scaffold( // appBar: AppBar( // title: const Text("Horizontal ListView"), // centerTitle: true, // ), // body: Container( // margin: EdgeInsets.symmetric(vertical: 20.0), // height: 100.0, // child: ListView( // scrollDirection: Axis.horizontal, // children: ...

Network Image

  import "package:flutter/material.dart" ; void main () { runApp( MyApp ()) ; } class MyApp extends StatelessWidget { MyApp({ super .key}) ; @override Widget build (BuildContext context) { return MaterialApp ( title: "Network Image" , debugShowCheckedModeBanner: false, theme: ThemeData ( primarySwatch: Colors. grey , ) , home: NetworkDemo () , ) ; } } class NetworkDemo extends StatelessWidget { NetworkDemo({ super .key}) ; @override Widget build (BuildContext context) { return Scaffold ( appBar: AppBar ( title: const Text ( "Network Image" ) , centerTitle: true, backgroundColor: Colors. grey , ) , body: Center ( child: Padding ( padding: const EdgeInsets . all ( 58.0 ) , child: Image . network ( "https://media.istockphoto.com/id/1166613720/photo/sunflower-" "in-full-bloom-with-blue-sky.jpg?s=20...