@@ -118,6 +118,11 @@ class ShareResourceButton extends StatefulWidget {
118118
119119 final ValueChanged <bool >? onShowFullPathChanged;
120120
121+ /// Optional background color for the Share Resource button.
122+ /// When provided, overrides the theme's elevated button background.
123+
124+ final Color ? shareButtonColor;
125+
121126 const ShareResourceButton ({
122127 super .key,
123128 required this .fileNameController,
@@ -134,6 +139,7 @@ class ShareResourceButton extends StatefulWidget {
134139 this .onShowFullPathChanged,
135140 this .dataFilesMap = const {},
136141 this .onPermissionGranted,
142+ this .shareButtonColor,
137143 });
138144
139145 @override
@@ -201,13 +207,13 @@ class _ShareResourceButtonState extends State<ShareResourceButton> {
201207 mainAxisAlignment: MainAxisAlignment .end,
202208 spacing: 5 ,
203209 children: [
210+ // Show full path switch
204211 if (widget.resourceNames != null || widget.resourceName != null ) ...[
205212 const Text (
206213 'Show\n Full Path' ,
207214 maxLines: 2 ,
208215 overflow: TextOverflow .ellipsis,
209216 textAlign: TextAlign .end,
210- // style: TextStyle(fontSize: 12, color: Colors.grey.shade700),
211217 ),
212218 Switch (
213219 value: widget.showFullPath,
@@ -219,8 +225,20 @@ class _ShareResourceButtonState extends State<ShareResourceButton> {
219225 onChanged: widget.onShowFullPathChanged,
220226 ),
221227 ],
228+ // Share Resource/s button
222229 ElevatedButton .icon (
223230 icon: const Icon (Icons .share),
231+ // Set share button background color to
232+ // parameter shareButtonColor or
233+ // theme elevated button color
234+ // or elevated button default (grey)
235+ style: widget.shareButtonColor != null
236+ ? Theme .of (context).elevatedButtonTheme.style? .copyWith (
237+ backgroundColor: WidgetStateProperty .all <Color >(
238+ widget.shareButtonColor! ,
239+ ),
240+ )
241+ : Theme .of (context).elevatedButtonTheme.style,
224242 onPressed: () async {
225243 // Assign dataFile if null (first Grant press)
226244 _resourceName = widget.resourceName ?? _fileNameController.text;
0 commit comments