import '/components/permission_list_widget.dart';
import '/flutterlib/flutter_theme.dart';
import '/flutterlib/flutter_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
import 'permission_list_container3_model.dart';
export 'permission_list_container3_model.dart';

class PermissionListContainer3Widget extends StatefulWidget {
  const PermissionListContainer3Widget({
    Key? key,
    String? roleID,
    this.getPermissionsList,
  })  : this.roleID = roleID ?? '',
        super(key: key);

  final String roleID;
  final List<int>? getPermissionsList;

  @override
  _PermissionListContainer3WidgetState createState() =>
      _PermissionListContainer3WidgetState();
}

class _PermissionListContainer3WidgetState
    extends State<PermissionListContainer3Widget> {
  late PermissionListContainer3Model _model;

  @override
  void setState(VoidCallback callback) {
    super.setState(callback);
    _model.onUpdate();
  }

  @override
  void initState() {
    super.initState();
    _model = createModel(context, () => PermissionListContainer3Model());
  }

  @override
  void dispose() {
    _model.maybeDispose();

    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    context.watch<FFAppState>();

    return Container(
      decoration: BoxDecoration(),
      child: Align(
        alignment: AlignmentDirectional(0.0, 0.0),
        child: wrapWithModel(
          model: _model.permissionListModel,
          updateCallback: () => setState(() {}),
          updateOnChange: true,
          child: PermissionListWidget(
            roleID: widget.roleID,
            getPermissionsList: widget.getPermissionsList,
          ),
        ),
      ),
    );
  }
}
