flutter_profile_manager 0.0.1+3 copy "flutter_profile_manager: ^0.0.1+3" to clipboard
flutter_profile_manager: ^0.0.1+3 copied to clipboard

outdated

Create a profile form with updated data.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_profile_manager/flutter_profile_manager.dart';
import 'package:flutter_profile_manager/models/Field.dart';
import 'package:flutter_profile_manager/enums/TypeField.dart';
import 'package:flutter_mobile_camera/CameraBuilder.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Map<String, FieldModel> _map = Map<String, FieldModel>();

  @override
  void initState() {
    super.initState();

    _map.addAll(
      {
        'avatarURL': FieldModel(
          id: 'avatarURL',
          icon: null,
          label: null,
          defaultValue: 'John Doe',
          value: 'https://picsum.photos/200',
          onUpdated: (value) => null,
          type: TypeField.AVATAR,
        ),
        'email': FieldModel(
          id: 'email',
          icon: Icons.email,
          label: 'Email',
          value: 'john.doe@domain.tld',
          onUpdated: (value) => null,
          type: TypeField.EMAIL,
          fieldPlaceholder: 'Enter your email',
        ),
        'username': FieldModel(
          id: 'username',
          icon: Icons.person,
          label: 'Username',
          value: 'john doe',
          onUpdated: (value) => null,
          fieldPlaceholder: 'Enter your username',
        ),
        'status': FieldModel(
          id: 'status',
          icon: Icons.info,
          label: 'About',
          value:
              'Le lorem ipsum est, en imprimerie, une suite de mots sans signification utilisée à titre provisoire.',
          onUpdated: (value) => null,
          fieldPlaceholder: 'Enter your status',
        ),
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return CameraBuilder(
      child: MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            title: const Text('Plugin example app'),
          ),
          body: ProfileManager(
            onCancled: (FieldModel fieldMode) => null,
            onUpdated: (dynamic value, FieldModel fieldModel) {
              if (fieldModel.id != 'avatarURL') {
                _map[fieldModel.id].updateValue = value;
              } else {
                // Convert path to URL
              }

              setState(() => print('refresh view...'));
            },
            fields: _map.values.toList(),
          ),
        ),
      ),
    );
  }
}
1
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Create a profile form with updated data.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, flutter_inputs, flutter_profile_avatar

More

Packages that depend on flutter_profile_manager