-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: comms buttons docs: changed comms button example to use assorted constructors docs: set initial values for comms button on widgetbook fix: added different constructors to zetacommsbutton chore(automated): Lint commit and format fix: set toggle related properties on non-toggle constructors to null docs: added comments to the class about named constructors fix: changed Colors.transparent to Zeta.of(context).colors.surfaceDefault test: comms goldens
- Loading branch information
Showing
13 changed files
with
961 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,262 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:zeta_example/widgets.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
class CommsButtonExample extends StatelessWidget { | ||
static const String name = 'CommsButton'; | ||
|
||
const CommsButtonExample({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ExampleScaffold( | ||
name: name, | ||
child: SingleChildScrollView( | ||
child: Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: Wrap( | ||
runSpacing: Zeta.of(context).spacing.xl_3, | ||
alignment: WrapAlignment.start, | ||
children: [ | ||
Column( | ||
children: [ | ||
ZetaCommsButton.reject( | ||
label: 'Reject', | ||
size: ZetaWidgetSize.large, | ||
), | ||
ZetaCommsButton.reject( | ||
label: 'Reject', | ||
size: ZetaWidgetSize.medium, | ||
), | ||
ZetaCommsButton.reject( | ||
label: 'Reject', | ||
size: ZetaWidgetSize.small, | ||
), | ||
].gap(Zeta.of(context).spacing.large), | ||
), | ||
Column( | ||
children: [ | ||
ZetaCommsButton.answer( | ||
label: 'Answer', | ||
size: ZetaWidgetSize.large, | ||
), | ||
ZetaCommsButton.answer( | ||
label: 'Answer', | ||
size: ZetaWidgetSize.medium, | ||
), | ||
ZetaCommsButton.answer( | ||
label: 'Answer', | ||
size: ZetaWidgetSize.small, | ||
), | ||
].gap(Zeta.of(context).spacing.large), | ||
), | ||
Column( | ||
children: [ | ||
ZetaCommsButton.mute( | ||
label: 'Mute', | ||
size: ZetaWidgetSize.large, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'Un-Mute', | ||
), | ||
ZetaCommsButton.mute( | ||
label: 'Mute', | ||
size: ZetaWidgetSize.medium, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'Un-Mute', | ||
), | ||
ZetaCommsButton.mute( | ||
label: 'Mute', | ||
size: ZetaWidgetSize.small, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'Un-Mute', | ||
), | ||
].gap(Zeta.of(context).spacing.large), | ||
), | ||
Column( | ||
children: [ | ||
ZetaCommsButton.video( | ||
label: 'Hide Video', | ||
size: ZetaWidgetSize.large, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'Show Video', | ||
), | ||
ZetaCommsButton.video( | ||
label: 'Hide Video', | ||
size: ZetaWidgetSize.medium, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'Show Video', | ||
), | ||
ZetaCommsButton.video( | ||
label: 'Hide Video', | ||
size: ZetaWidgetSize.small, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'Show Video', | ||
), | ||
].gap(Zeta.of(context).spacing.large), | ||
), | ||
Column( | ||
children: [ | ||
ZetaCommsButton.transfer( | ||
label: 'Transfer', | ||
size: ZetaWidgetSize.large, | ||
), | ||
ZetaCommsButton.transfer( | ||
label: 'Transfer', | ||
size: ZetaWidgetSize.medium, | ||
), | ||
ZetaCommsButton.transfer( | ||
label: 'Transfer', | ||
size: ZetaWidgetSize.small, | ||
), | ||
].gap(Zeta.of(context).spacing.large), | ||
), | ||
Column( | ||
children: [ | ||
ZetaCommsButton.hold( | ||
label: 'Hold Call', | ||
size: ZetaWidgetSize.large, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'On Hold', | ||
), | ||
ZetaCommsButton.hold( | ||
label: 'Hold Call', | ||
size: ZetaWidgetSize.medium, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'On Hold', | ||
), | ||
ZetaCommsButton.hold( | ||
label: 'Hold Call', | ||
size: ZetaWidgetSize.small, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'On Hold', | ||
), | ||
].gap(Zeta.of(context).spacing.large), | ||
), | ||
Column( | ||
children: [ | ||
ZetaCommsButton.speaker( | ||
label: 'Speaker On', | ||
size: ZetaWidgetSize.large, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'Speaker Off', | ||
), | ||
ZetaCommsButton.speaker( | ||
label: 'Speaker On', | ||
size: ZetaWidgetSize.medium, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'Speaker Off', | ||
), | ||
ZetaCommsButton.speaker( | ||
label: 'Speaker On', | ||
size: ZetaWidgetSize.small, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'Speaker Off', | ||
), | ||
].gap(Zeta.of(context).spacing.large), | ||
), | ||
Column( | ||
children: [ | ||
ZetaCommsButton.record( | ||
label: 'Record', | ||
size: ZetaWidgetSize.large, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'Stop', | ||
), | ||
ZetaCommsButton.record( | ||
label: 'Record', | ||
size: ZetaWidgetSize.medium, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'Stop', | ||
), | ||
ZetaCommsButton.record( | ||
label: 'Record', | ||
size: ZetaWidgetSize.small, | ||
onToggle: (isToggled) { | ||
print('Toggled'); | ||
print(isToggled); | ||
}, | ||
toggledLabel: 'Stop', | ||
), | ||
].gap(Zeta.of(context).spacing.large), | ||
), | ||
Column( | ||
children: [ | ||
ZetaCommsButton.add( | ||
label: 'Add', | ||
size: ZetaWidgetSize.large, | ||
), | ||
ZetaCommsButton.add( | ||
label: 'Add', | ||
size: ZetaWidgetSize.medium, | ||
), | ||
ZetaCommsButton.add( | ||
label: 'Add', | ||
size: ZetaWidgetSize.small, | ||
), | ||
].gap(Zeta.of(context).spacing.large), | ||
), | ||
Column( | ||
children: [ | ||
ZetaCommsButton.security( | ||
label: 'Security', | ||
size: ZetaWidgetSize.large, | ||
), | ||
ZetaCommsButton.security( | ||
label: 'Security', | ||
size: ZetaWidgetSize.medium, | ||
), | ||
ZetaCommsButton.security( | ||
label: 'Security', | ||
size: ZetaWidgetSize.small, | ||
), | ||
].gap(Zeta.of(context).spacing.large), | ||
), | ||
].gap(Zeta.of(context).spacing.large), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
example/widgetbook/pages/components/comms_button_widgetbook.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
import '../../utils/scaffold.dart'; | ||
import '../../utils/utils.dart'; | ||
|
||
Widget commsButtonUseCase(BuildContext context) { | ||
return WidgetbookScaffold( | ||
builder: (context, _) => ZetaCommsButton( | ||
label: context.knobs.string( | ||
label: 'Text', | ||
initialValue: 'Answer', | ||
), | ||
size: context.knobs.list( | ||
label: 'Size', | ||
options: ZetaWidgetSize.values, | ||
labelBuilder: enumLabelBuilder, | ||
initialOption: ZetaWidgetSize.medium, | ||
), | ||
type: context.knobs.list( | ||
label: 'Type', | ||
options: ZetaCommsButtonType.values, | ||
labelBuilder: enumLabelBuilder, | ||
initialOption: ZetaCommsButtonType.positive, | ||
), | ||
icon: iconKnob( | ||
context, | ||
nullable: false, | ||
name: "Icon", | ||
initial: ZetaIcons.phone, | ||
), | ||
), | ||
); | ||
} |
Oops, something went wrong.