formstack 0.1.8 copy "formstack: ^0.1.8" to clipboard
formstack: ^0.1.8 copied to clipboard

A flutter library to create a UI based on the model from either json or dart object.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:formstack/formstack.dart';

void main() {
  FormStack.api().form(steps: [
    InstructionStep(
        id: GenericIdentifier(id: "IS_STARTED"),
        title: "Example Survey",
        text: "Simple survey example using dart model",
        cancellable: false),
    QuestionStep(
      title: "Name",
      text: "Your name",
      inputType: InputType.name,
      id: GenericIdentifier(id: "NAME"),
    ),
    QuestionStep(
      title: "Your Email ?",
      text: "Tell Email address",
      inputType: InputType.email,
      id: GenericIdentifier(id: "EMAIL"),
    ),
    QuestionStep(
      title: "Phone Number",
      text: "Share your phone number.",
      inputType: InputType.number,
      id: GenericIdentifier(id: "NUM"),
    ),
    QuestionStep(
      title: "Comment",
      text:
          "Tell us about your self and why you want our help to imprve your health.",
      inputType: InputType.text,
      numberOfLines: 5,
      id: GenericIdentifier(id: "COMMENT"),
    ),
    QuestionStep(
      title: "Multiple Choice",
      text:
          "Tell us about your self and why you want our help to imprve your health.",
      inputType: InputType.multipleChoice,
      options: [
        Options("IN", "India"),
        Options("CH", "China"),
        Options("AM", "America"),
        Options("SR", "Sreelanka")
      ],
      id: GenericIdentifier(id: "MULTIPLE_CHOICE"),
    ),
    QuestionStep(
      title: "Single Choice",
      text:
          "Tell us about your self and why you want our help to imprve your health.",
      inputType: InputType.singleChoice,
      options: [
        Options("IN", "India"),
        Options("CH", "China"),
        Options("AM", "America"),
        Options("SR", "Sreelanka")
      ],
      id: GenericIdentifier(id: "SINGLE_CHOICE"),
    ),
    QuestionStep(
      title: "Time Only",
      text:
          "Tell us about your self and why you want our help to imprve your health.",
      inputType: InputType.time,
      id: GenericIdentifier(id: "TIME_ONLY"),
    ),
    QuestionStep(
      title: "Date Of Birth",
      text:
          "Tell us about your self and why you want our help to imprve your health.",
      inputType: InputType.dateTime,
      id: GenericIdentifier(id: "DATE_TIME"),
    ),
    QuestionStep(
      title: "Are you happy",
      text:
          "Tell us about your self and why you want our help to imprve your health.",
      inputType: InputType.smile,
      id: GenericIdentifier(id: "IS_HAPPY"),
    ),
    QuestionStep(
      title: "Date Of Birth",
      text:
          "Tell us about your self and why you want our help to imprve your health.",
      inputType: InputType.date,
      id: GenericIdentifier(id: "DOB"),
    ),
    CompletionStep(
      id: GenericIdentifier(id: "IS_COMPLETED"),
      title: "Survey Completed",
      text: "ENd Of ",
      onFinish: (result) {
        debugPrint("Completed With Result : $result");
      },
    ),
  ]);
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    SystemChrome.setSystemUIOverlayStyle(
      const SystemUiOverlayStyle(
        systemNavigationBarColor: Colors.white,
        systemNavigationBarDividerColor: Colors.white,
        systemNavigationBarIconBrightness: Brightness.dark,
      ),
    );
    return MaterialApp(
        theme: ThemeData(
          useMaterial3: true,
          // colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.indigo),
        ),
        home: FormStack.api().render(),
        debugShowCheckedModeBanner: false);
  }
}
35
likes
0
pub points
47%
popularity

Publisher

verified publishersudhi.in

A flutter library to create a UI based on the model from either json or dart object.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, intl, lottie, reviews_slider, uuid

More

Packages that depend on formstack