Last updated:
0 purchases
sampod
Sampod #
Overview #
Sampod is a lightweight state management solution for Flutter. It simplifies state management by using a streamlined API and easy-to-understand approach. Sampod is designed to enhance Flutter applications by providing a more efficient way to manage state across your widgets.
Features #
Simple State Management: Easily manage state using Sampod controllers.
Efficient State Updates: Quickly update and reflect changes in the UI.
Integration: Seamlessly integrates with Flutter's existing widgets and state management techniques.
Getting Started #
To get started with Sampod, follow these steps:
Add Dependency:
Copy code
dependencies:
sampod: ^0.0.8
copied to clipboard
Copy code
import 'package:sampod/sampod.dart';
import 'package:sampod/sampod_builder.dart';
import 'package:sampod/sampod_provider.dart';
// Setup Your App:
// Use SampodProvider and SampodBuilder to manage and update state in your Flutter application.
copied to clipboard
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Sampod',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyWidget(),
);
}
}
class MyWidget extends StatefulWidget {
const MyWidget({super.key});
@override
State<MyWidget> createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> {
final SliderSampod sliderSampod = SliderSampod();
final OpacitySampod opacitySampod = OpacitySampod();
@override
Widget build(BuildContext context) {
return SampodProvider(
controller: sliderSampod,
builder: (context, sliderSampod) {
return SampodProvider(
controller: opacitySampod,
builder: (context, opacitySampod) {
return Scaffold(
body: Column(
children: [
Text((Random().nextDouble().toString())),
const SizedBox(height: 100),
SampodBuilder<SliderSampod>(
builder: (context, sliderSampod) {
return Slider(
value: sliderSampod.slider,
onChanged: (value) {
SampodProvider.of<SliderSampod>(context)
.slidetChange(value);
SampodProvider.of<OpacitySampod>(context)
.slidetChange(value);
},
);
},
),
Opacity(
opacity: opacitySampod.opacity,
child: Container(
width: double.infinity,
height: 200,
color: const Color.fromARGB(255, 0, 187, 187),
),
),
const NewWidget(),
],
),
);
},
);
},
);
}
}
class NewWidget extends StatelessWidget {
const NewWidget({super.key});
@override
Widget build(BuildContext context) {
return SampodBuilder<OpacitySampod>(
builder: (context, opacitySampod) {
return Opacity(
opacity: opacitySampod.opacity,
child: Container(
width: double.infinity,
height: 200,
color: Colors.green,
),
);
},
);
}
}
class SliderSampod extends Sampod {
double slider = 0;
void slidetChange(double value) {
slider = value;
notifyListeners();
}
}
class OpacitySampod extends Sampod {
double opacity = 0;
void slidetChange(double value) {
opacity = value;
notifyListeners();
}
}
copied to clipboard
#API Documentation
Sampod: #
Base class for state management.
SampodProvider: #
Provides state management to child widgets.
SampodBuilder: #
Builds widgets based on the state.
Contributing #
We welcome contributions! Please follow our contribution guidelines for details on how to get involved.
License #
This project is licensed under the MIT License.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.