How To Add Padding To Checkbox Using Flutter Android

admin_img Posted By Bajarangi soft , Posted On 06-11-2020

The value, onChanged, activeColor padding and checkColor properties of this widget are identical to the similarly-named properties on the Checkbox widget..

How To Add Padding To Checkbox Using Flutter Android

Padding To Checkbox
Complete Code For Padding To Checkbox In Flutter
main.dart

import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  MyHomePageState createState() {
    return new MyHomePageState();
  }
}

class MyHomePageState extends State<MyHomePage> {
  bool _isChecked = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.red[700],
        title: Text("Space To Checkbox"),
      ),
      body: Center(
        child: CheckboxListTile(
          activeColor: Colors.red[800],
          value: _isChecked,
          onChanged: (bool val) => setState(() => _isChecked = val),
          title: Text("CheckBox Text"),
          controlAffinity: ListTileControlAffinity.leading,
        ),
      ),
    );
  }
}

Related Post