ShareButtonsComponent class
A stateless widget rendering a horizontal row of social share buttons.
Displays configurable share buttons for distributing meeting links via various channels. Provides 5 default share buttons (copy, email, Facebook, WhatsApp, Telegram) or accepts custom button configurations for brand-specific sharing options.
Default Share Actions:
- Copy (Icons.copy): Copies URL to clipboard using FlutterClipboard
- Email (Icons.email): Opens mailto: link with pre-filled subject/body
- Facebook (Icons.facebook): Opens Facebook sharer with encoded URL
- WhatsApp (FontAwesomeIcons.whatsapp): Opens WhatsApp share dialog
- Telegram (FontAwesomeIcons.telegram): Opens Telegram share URL dialog
Share URL Generation (getShareUrl):
if (localLink && !localLink.contains('mediasfu.com')) {
return '{localLink}/meeting/{meetingID}';
} else {
shareName = eventType == chat ? 'chat' :
eventType == broadcast ? 'broadcast' : 'meeting';
return 'https://{shareName}.mediasfu.com/{shareName}/{meetingID}';
}
Rendering Structure:
Row (mainAxisAlignment: center)
├─ GestureDetector (onTap: button.action)
│ └─ Container
│ ├─ padding: 5px all
│ ├─ margin: 8px horizontal
│ ├─ backgroundColor: button.backgroundColor
│ ├─ borderRadius: 5px
│ └─ Icon (24px, button.icon, button.iconColor)
└─ ... (repeated for each visible button)
Common Use Cases:
-
Default Share Buttons:
ShareButtonsComponent( options: ShareButtonsComponentOptions( meetingID: parameters.meetingID, eventType: EventType.conference, ), ) // Shows: Copy, Email, Facebook, WhatsApp, Telegram
-
Custom Domain Sharing:
ShareButtonsComponent( options: ShareButtonsComponentOptions( meetingID: "XYZ123", eventType: EventType.webinar, localLink: "https://webinars.company.com", ), ) // Share URL: https://webinars.company.com/meeting/XYZ123
-
Custom Buttons Only:
ShareButtonsComponent( options: ShareButtonsComponentOptions( meetingID: "ABC456", eventType: EventType.broadcast, customButtons: [ ShareButtonOptions( icon: FontAwesomeIcons.twitter, action: () { final twitterUrl = 'https://twitter.com/intent/tweet?url=${Uri.encodeComponent(url)}'; launchUrl(Uri.parse(twitterUrl)); }, backgroundColor: Color(0xFF1DA1F2), ), ShareButtonOptions( icon: FontAwesomeIcons.linkedin, action: () { final linkedInUrl = 'https://www.linkedin.com/sharing/share-offsite/?url=${Uri.encodeComponent(url)}'; launchUrl(Uri.parse(linkedInUrl)); }, backgroundColor: Color(0xFF0A66C2), ), ShareButtonOptions( icon: Icons.message, action: () => shareViaSMS(url), backgroundColor: Colors.green, ), ], ), )
-
Conditional Button Display:
ShareButtonsComponent( options: ShareButtonsComponentOptions( meetingID: meetingId, eventType: EventType.conference, customButtons: [ ShareButtonOptions( icon: Icons.copy, action: () => copyToClipboard(url), show: true, // always show ), ShareButtonOptions( icon: FontAwesomeIcons.twitter, action: () => shareToTwitter(url), show: enableTwitter, // conditional ), ShareButtonOptions( icon: FontAwesomeIcons.slack, action: () => shareToSlack(url), show: userHasSlackIntegration, // conditional ), ], ), )
Button Filtering:
- Only buttons with
show: true
are rendered .where((button) => button.show)
filters visible buttons- Allows dynamic button visibility based on permissions, features, or settings
URL Encoding:
- All share URLs are properly encoded using
Uri.encodeComponent()
- Handles special characters in meeting IDs and custom domains
- Prevents URL injection or malformed links
External Dependencies:
url_launcher
: Opens email, social media URLs in external apps/browsersclipboard
: Copies URLs to system clipboardfont_awesome_flutter
: Provides social media icons (WhatsApp, Telegram)
Styling:
- Button size: 24px icon + 5px padding + 8px margin = ~42px total width
- Default colors: Blue background, white icon
- Rounded corners: 5px border radius
- Center-aligned row with even spacing
Typical Usage Context:
- ShareEventModal share section
- MenuModal quick share actions
- Post-meeting feedback/invite screen
- Meeting lobby "Invite Others" section
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ShareButtonsComponent
Constructors
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- options → ShareButtonsComponentOptions
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited