पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv0.1.0

flow_builder

Flutter Flows आसान बनाएं! एक Flutter पैकेज जो लचीले, घोषणात्मक API के साथ प्रवाह को सरल बनाता है।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
52.3 हज़ार
लाइक
440
Pub अंक
150

पैकेज इंस्टॉल करें

flutter pub add flow_builder

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

Flow Builder एक Flutter पैकेज है जो लचीले, घोषणात्मक API के साथ एप्लिकेशन फ्लो के निर्माण और प्रबंधन को सरल बनाता है। यह विकासकर्ताओं को जटिल नेविगेशन अनुक्रम और राज्य संक्रमण को साफ़, पठनीय तरीके से परिभाषित करने में सक्षम बनाता है, बॉइलरप्लेट कोड को कम करता है। ऑनबोर्डिंग, चेकआउट फ्लो या विजार्ड जैसे बहु-चरण प्रक्रियाओं के प्रबंधन के लिए आदर्श है, यह बनाए रखने योग्य और स्केलेबल फ्लो तर्क को बढ़ावा देता है। पैकेज सभी प्रमुख प्लेटफॉर्म के लिए समर्थन करता है, जिसमें Android, iOS, Web, macOS, Windows और Linux शामिल हैं।

उपयोग

  • ऑनबोर्डिंग फ्लो
  • चेकआउट प्रक्रियाएं
  • बहु-चरण जादूगर
  • स्थायी नेविगेशन
  • जटिल रूटिंग तर्क

मुख्य विशेषताएँ

  • घोषणात्मक प्रवाह परिभाषा
  • न्यूनतम बॉयलरप्लेट
  • राज्य प्रबंधन एकीकरण
  • प्लेटफॉर्म-समर्थन
  • लचीला संक्रमण प्रबंधन

इनके लिए उपयुक्त

  • जटिल नेविगेशन बनाने वाले डेवलपर्स
  • साफ कोड प्राथमिकता देने वाली टीमें
  • बहु-चरण उपयोगकर्ता यात्रा वाले प्रोजेक्ट
  • गतिशील धारा नियंत्रण की आवश्यकता वाले ऐप्स

विचार योग्य बातें

  • अवस्था प्रबंधन की समझ आवश्यक है
  • स्पष्ट संक्रमण वाले प्रवाह के लिए सबसे उपयुक्त
  • सरल नेविगेशन के लिए अतिरिक्त ओवरहेड जोड़ सकता है
  • कोर नेविगेटर का प्रतिस्थापन नहीं है

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

Flow Builder

Flutter Flows made easy!

build coverage pub package

Usage

Define a Flow State

The flow state will be the state which drives the flow. Each time this state changes, a new navigation stack will be generated based on the new flow state.

class Profile {
  const Profile({this.name, this.age, this.weight});

  final String? name;
  final int? age;
  final int? weight;

  Profile copyWith({String? name, int? age, int? weight}) {
    return Profile(
      name: name ?? this.name,
      age: age ?? this.age,
      weight: weight ?? this.weight,
    );
  }
}
Create a FlowBuilder

FlowBuilder is a widget which builds a navigation stack in response to changes in the flow state. onGeneratePages will be invoked for each state change and must return the new navigation stack as a list of pages.

FlowBuilder<Profile>(
  state: const Profile(),
  onGeneratePages: (profile, pages) {
    return [
      MaterialPage(child: NameForm()),
      if (profile.name != null) MaterialPage(child: AgeForm()),
    ];
  },
);
Update the Flow State

The state of the flow can be updated via context.flow<T>().update.

class NameForm extends StatefulWidget {
  @override
  _NameFormState createState() => _NameFormState();
}

class _NameFormState extends State<NameForm> {
  var _name = '';

  void _continuePressed() {
    context.flow<Profile>().update((profile) => profile.copyWith(name: _name));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Name')),
      body: Center(
        child: Column(
          children: <Widget>[
            TextField(
              onChanged: (value) => setState(() => _name = value),
              decoration: InputDecoration(
                labelText: 'Name',
                hintText: 'John Doe',
              ),
            ),
            RaisedButton(
              child: const Text('Continue'),
              onPressed: _name.isNotEmpty ? _continuePressed : null,
            )
          ],
        ),
      ),
    );
  }
}
Complete the Flow

The flow can be completed via context.flow<T>().complete.

class AgeForm extends StatefulWidget {
  @override
  _AgeFormState createState() => _AgeFormState();
}

class _AgeFormState extends State<AgeForm> {
  int? _age;

  void _continuePressed() {
    context
        .flow<Profile>()
        .complete((profile) => profile.copyWith(age: _age));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Age')),
      body: Center(
        child: Column(
          children: <Widget>[
            TextField(
              onChanged: (value) => setState(() => _age = int.parse(value)),
              decoration: InputDecoration(
                labelText: 'Age',
                hintText: '42',
              ),
              keyboardType: TextInputType.number,
            ),
            RaisedButton(
              child: const Text('Continue'),
              onPressed: _age != null ? _continuePressed : null,
            )
          ],
        ),
      ),
    );
  }
}
FlowController

A FlowBuilder can also be created with a custom FlowController in cases where the flow can be manipulated outside of the sub-tree.

class MyFlow extends StatefulWidget {
  @override
  State<MyFlow> createState() => _MyFlowState();
}

class _MyFlowState extends State<MyFlow> {
  late FlowController<Profile> _controller;

  @override
  void initState() {
    super.initState();
    _controller = FlowController(const Profile());
  }

  @override
  Widget build(BuildContext context) {
    return FlowBuilder(
      controller: _controller,
      onGeneratePages: ...,
    );
  }

  @override dispose() {
    _controller.dispose();
    super.dispose();
  }
}

श्रेणियाँ

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट