π‘οΈ Temperature Slider
A beautiful and intuitive temperature and speed slider plugin for Flutter with smooth animations and customizable design.
β¨ Features
- π‘οΈ Temperature Slider: Smooth temperature control from 5Β°C to 30Β°C
- π Speed Slider: Discrete speed levels (Sleep, Vel1, Vel2, Vel3, Boost)
- π¨ Dynamic Background: Color changes based on temperature
- π± Responsive Design: Adapts to different screen sizes
- β‘ Smooth Animations: Fluid transitions and interactions
- π Easy Toggle: Switch between temperature and speed modes
- π¦ Self-Contained: No external setup required
- π― Zero Configuration: Works out of the box
π± Preview
The plugin provides two slider modes:
- Temperature Mode: Continuous temperature control with visual feedback
- Speed Mode: Discrete speed levels with snapping behavior
π Getting Started
Installation
Add this to your package's pubspec.yaml file:
dependencies:
speed_temp_slider: ^1.0.0
Then run:
flutter pub get
Basic Usage
import 'package:flutter/material.dart';
import 'package:speed_temp_slider/speed_temp_slider.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: TemperatureController(),
),
);
}
}
That's it! The plugin is completely self-contained and requires no additional setup.
π Advanced Usage
Accessing Current Values
If you need to access the current temperature or speed values:
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:speed_temp_slider/speed_temp_slider.dart';
class MyAdvancedApp extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return MaterialApp(
home: Scaffold(
body: Column(
children: [
Expanded(child: TemperatureController()),
// Access current values (requires exposing providers)
Consumer(
builder: (context, ref, child) {
// Note: Providers would need to be exported for this to work
return Text('Current temperature: ${ref.watch(temperatureProvider)}Β°C');
},
),
],
),
),
);
}
}
Custom Integration
The plugin can be easily integrated into existing apps:
class HomeScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Climate Control')),
body: Column(
children: [
Text('Room Temperature Control', style: Theme.of(context).textTheme.headlineMedium),
Expanded(
child: TemperatureController(),
),
ElevatedButton(
onPressed: () {
// Your custom actions
},
child: Text('Apply Settings'),
),
],
),
);
}
}
π¨ Customization
The plugin uses a responsive design that adapts to your app's theme and screen size. The background color automatically transitions from cool blue to warm orange based on the temperature setting.
Slider Behavior
- Temperature Slider: Continuous values from 5.0Β°C to 30.0Β°C
- Speed Slider: Discrete values that snap to predefined levels
- Sleep (5Β°C equivalent)
- Vel1 (10Β°C equivalent)
- Vel2 (20Β°C equivalent)
- Vel3 (25Β°C equivalent)
- Boost (30Β°C equivalent)
ποΈ Architecture
This plugin uses:
- Flutter Riverpod for state management
- Self-contained ProviderScope for isolation
- Responsive design principles
- Smooth animations with
AnimatedContainer
π€ Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development Setup
- Fork the repository
- Clone your fork:
git clone https://github.com/algrassi/speed_temp_slider.git - Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Add tests if applicable
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
π Requirements
- Flutter SDK:
>=3.0.0 - Dart SDK:
>=3.0.0 <4.0.0
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Issues and Feedback
Please file feature requests and bugs at the issue tracker.
π API Documentation
For detailed API documentation, visit pub.flutter-io.cn documentation.
π Changelog
See CHANGELOG.md for a detailed list of changes in each version.
β€οΈ Support
If you find this plugin helpful, please give it a β on GitHub and a π on pub.flutter-io.cn!
Made with β€οΈ by Alessandro Grassi