### Import light_dark_theme_toggle in Dart Source: https://pub.dev/packages/light_dark_theme_toggle/install Import the package into your Dart files to start using its widgets and functionalities. ```dart import 'package:light_dark_theme_toggle/light_dark_theme_toggle.dart'; ``` -------------------------------- ### Basic Light/Dark Theme Toggle Implementation Source: https://pub.dev/packages/light_dark_theme_toggle/example Shows how to use the LightDarkThemeToggle widget in an AppBar to switch between light and dark themes for the entire application. The state is managed using StatefulWidget and setState. ```dart import 'package:flutter/material.dart'; import 'package:light_dark_theme_toggle/light_dark_theme_toggle.dart'; void main() => runApp(const MyApp()); class MyApp extends StatefulWidget { const MyApp({super.key}); @override State< એપ્લિકેશન> createState() => _MyAppState(); } class _MyAppState extends State { bool isDarkMode = false; @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: isDarkMode ? ThemeData.dark() : ThemeData.light(), home: Scaffold( appBar: AppBar( title: const Text('Light/Dark Theme Toggle Example'), actions: [ Padding( padding: const EdgeInsets.only(right: 16.0), child: LightDarkThemeToggle( value: isDarkMode, onChanged: (value) { setState(() { isDarkMode = value; }); }, ), ), ], ), body: Center(child: Text('Content goes here')), ), ); } } ``` -------------------------------- ### Import the Package Source: https://pub.dev/packages/light_dark_theme_toggle Import the necessary package into your Dart file to use the LightDarkThemeToggle widget. ```dart import 'package:light_dark_theme_toggle/light_dark_theme_toggle.dart'; ``` -------------------------------- ### Add light_dark_theme_toggle Dependency Source: https://pub.dev/packages/light_dark_theme_toggle/install Run this command to add the package to your Flutter project's dependencies. This automatically updates your pubspec.yaml file. ```bash $ flutter pub add light_dark_theme_toggle ``` -------------------------------- ### Basic Usage of LightDarkThemeToggle Widget Source: https://pub.dev/packages/light_dark_theme_toggle Demonstrates how to integrate the LightDarkThemeToggle widget into a Flutter application. Configure its initial state, size, icon type, color, tooltip, animation duration, and curve. The onChanged callback handles theme switching logic. ```dart import 'package:flutter/material.dart'; import 'package:light_dark_theme_toggle/light_dark_theme_toggle.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData.light(), darkTheme: ThemeData.dark(), themeMode: ThemeMode.system, home: Scaffold( appBar: AppBar(title: Text('Light/Dark Theme Toggle')), body: Center( child: LightDarkThemeToggle( value: false, // Initial value (false for dark, true for light) onChanged: (bool value) { // Handle theme change here. }, size: 48.0, themeIconType: ThemeIconType.expand, color: Colors.orange, tooltip: 'Toggle Theme', duration: Duration(milliseconds: 500), curve: Curves.easeInOut, ), ), ), ); } } ``` -------------------------------- ### MIT License Source: https://pub.dev/packages/light_dark_theme_toggle/license This is the standard MIT License text. It grants broad permissions for using, copying, modifying, merging, publishing, distributing, and selling the software, provided the copyright notice and permission notice are included. ```plaintext MIT License Copyright (c) 2025 Vivek Chib Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` -------------------------------- ### Add Dependency to pubspec.yaml Source: https://pub.dev/packages/light_dark_theme_toggle Add the light_dark_theme_toggle package as a dependency in your project's pubspec.yaml file. ```yaml dependencies: light_dark_theme_toggle: ^1.1.2 ``` -------------------------------- ### Customizable Light/Dark Theme Toggles with Different Icon Types Source: https://pub.dev/packages/light_dark_theme_toggle/example Demonstrates creating multiple LightDarkThemeToggle widgets with different sizes and icon types (e.g., sun, moon, stars) within a Card. This allows for varied visual representations of the theme toggle. ```dart import 'package:flutter/material.dart'; import 'package:light_dark_theme_toggle/light_dark_theme_toggle.dart'; // ... inside the MyApp widget's build method ... body: Center( child: Wrap( spacing: 10, runSpacing: 10, runAlignment: WrapAlignment.center, alignment: WrapAlignment.center, children: [ ...ThemeIconType.values.map( (themeIconType) { return Card( child: LightDarkThemeToggle( size: 128.0, themeIconType: themeIconType, value: isDarkMode, onChanged: (value) { setState(() { isDarkMode = value; }); }, ), ); }, ) ], ), ), // ... rest of the widget ... ``` -------------------------------- ### Using LightDarkThemeToggle with a specific icon type Source: https://pub.dev/packages/light_dark_theme_toggle Demonstrates how to instantiate the LightDarkThemeToggle widget and set a specific icon type using the themeIconType property. This is useful for customizing the visual representation of the theme switch. ```dart LightDarkThemeToggle( themeIconType:ThemeIconType.eclipse, ... ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.