Skip to content

Latest commit

 

History

History
255 lines (228 loc) · 6.79 KB

README.md

File metadata and controls

255 lines (228 loc) · 6.79 KB

Flutter Native Widgets

Adaptive Cupertino and Material widgets.



STARTED

final NativeWidgets nativeWidgets = NativeWidgets(context);


Adaptive Refresh Indicator



nativeWidgets.nativeRefreshIndicator(
  constructors: RefreshIndicatorModel(
    onRefresh: ()async{
      await Future.delayed(const Duration(seconds: 2));
    },
    children: [
        //Scroll Items
    ],
  ),
)
-----or-----
nativeWidgets.nativeRefreshIndicator(
  constructors: RefreshIndicatorModel(
    onRefresh: ()async{
      await Future.delayed(const Duration(seconds: 2));
    },
    itemBuilder: (context,index){
      return ListTile(title: Text('$index'),);
    }
  ),
)


Adaptive Ok Dialog



_button(
  title: 'Ok Dialog',
  onTap: () {
    nativeWidgets.nativeDialog(
      constructors: DialogModel(
        dialogType: DialogType.ok,
        title: 'Title',
        content: 'Content',
        okButtonProperties: ButtonProperties(
          buttonText: 'OK',
          onPress: () => Navigator.pop(context),
          isDefaultAction: true
        ),
      ),
    );
  },
),


Adaptive Ok Cancel Dialog



_button(
  title: 'Ok Cancel Dialog',
  onTap: () {
    nativeWidgets.nativeDialog(
      constructors: DialogModel(
        dialogType: DialogType.okCancel,
        title: 'Title',
        content: 'Content',
        okButtonProperties: ButtonProperties(
          buttonText: 'Cancel',
          onPress: () => Navigator.pop(context),
          isDestructiveAction: true
        ),
        cancelButtonProperties: ButtonProperties(
          buttonText: 'Ok',
          onPress: () => Navigator.pop(context),
          isDefaultAction: true
        ),
      ),
    );
  },
),


Adaptive Ok Input Dialog



_button(
  title: 'Ok Input Dialog',
  onTap: () {
    nativeWidgets.nativeDialog(
      constructors: DialogModel(
        dialogType: DialogType.inputOk,
        title: 'Title',
        content: 'Content',
        okButtonProperties: ButtonProperties(
          buttonText: 'OK',
          onPress: () => Navigator.pop(context),
          isDefaultAction: true
        ),
        cancelButtonProperties: ButtonProperties(
          buttonText: 'Ok',
          onPress: () => Navigator.pop(context),
          isDefaultAction: true
        ),
        inputProperties: DialogInputProperties(
          onChanged: (value){}
          //controller,focusNode...
        )
      ),
    );
  },
),


Adaptive Ok Cancel Input Dialog



_button(
  title: 'Ok Input Dialog',
  onTap: () {
    nativeWidgets.nativeDialog(
      constructors: DialogModel(
        dialogType: DialogType.inputOk,
        title: 'Title',
        content: 'Content',
        okButtonProperties: ButtonProperties(
          buttonText: 'OK',
          onPress: () => Navigator.pop(context),
          isDefaultAction: true
        ),
        inputProperties: DialogInputProperties(
          onChanged: (value){}
          //controller,focusNode...
        )
      ),
    );
  },
),


Adaptive Date Time Picker



_button(
   title: 'Date Time Picker',
   onTap: () {
     nativeWidgets.nativeDateTimePicker(
       constructors: DateTimePickerModel(
         pickerType: DateTimePickerType.dateAndTime,
         //DateTimePickerType.dateAndTime,DateTimePickerType.date,DateTimePickerType.time
         time: DateTime.now()
       ),
     );
   },
 ),


Adaptive Action Sheet



_button(
   title: 'Action Sheet Title and Content',
   onTap: () {
     nativeWidgets.nativeActionSheet(
       constructors: ActionSheetModel(
         title: 'Title',
         content: 'Content',
         actions: [
           ButtonProperties(
             buttonText: 'First Action',
             onPress: (){},
             icon: Icons.add
           ),
           ButtonProperties(
             buttonText: 'Second Action',
             onPress: (){},
             icon: Icons.add
           ),
         ]
       ),
     );
   },
 ),


Adaptive Switch and Progress Indicator



nativeWidgets.nativeSwitch(
  constructors: SwitchModel(
    activeColor: Colors.blue,
    value: true,
    onChanged: (value){}
  )
),
nativeWidgets.nativeIndicator(
  constructors: IndicatorModel()
),