Skip to content

Commit

Permalink
feat!: 💥 Remove builder widget (#400) (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
manoj-simform authored May 31, 2024
1 parent c0f67f1 commit fbf43c2
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 85 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- [BREAKING] Fixed [#434](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/434) removed deprecated text style after Flutter 3.22 follow [migration guide](https://docs.flutter.dev/release/breaking-changes/3-19-deprecations#texttheme)
- Updated minimum support to dart sdk 2.18.0
- Fixed [#449](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/449) - Null check operator used on a null value
- [BREAKING] Improvement [#400](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/400) - remove Builder widget

## [2.1.1]
- Fixed [#425](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/425) - Unhandled breaking change in v2.1.0
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,25 @@ A Flutter package allows you to Showcase/Highlight your widgets step by step.

![The example app running in Android](https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_showcaseview/master/preview/showcaseview.gif)

## Migration guide for release 3.0.0
Removed builder widget from `ShowCaseWidget` and replaced it with builder function

Before:
```dart
ShowCaseWidget(
builder: Builder(
builder : (context) => Somewidget()
),
),
```

After:
```dart
ShowCaseWidget(
builder : (context) => Somewidget(),
),
```

## Migration guide for release 2.0.0
Renamed properties/fields of widgets mentioned below in the table.

Expand Down
160 changes: 78 additions & 82 deletions example/lib/detailscreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,97 +25,93 @@ class _DetailState extends State<Detail> {
@override
Widget build(BuildContext context) {
return ShowCaseWidget(
builder: Builder(
builder: (context) {
myContext = context;
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: IconButton(
icon: const Icon(
Icons.arrow_back,
color: Colors.black,
),
onPressed: () {
Navigator.pop(context);
},
builder: (context) {
myContext = context;
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: IconButton(
icon: const Icon(
Icons.arrow_back,
color: Colors.black,
),
onPressed: () {
Navigator.pop(context);
},
),
body: Padding(
padding: const EdgeInsets.all(16),
child: ListView(
children: <Widget>[
Showcase(
key: _one,
title: 'Title',
description: 'Desc',
child: InkWell(
onTap: () {},
child: const Text(
'Flutter Notification',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w600,
),
),
body: Padding(
padding: const EdgeInsets.all(16),
child: ListView(
children: <Widget>[
Showcase(
key: _one,
title: 'Title',
description: 'Desc',
child: InkWell(
onTap: () {},
child: const Text(
'Flutter Notification',
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w600,
),
),
),
const SizedBox(
height: 16,
),
const Text(
'Hi, you have new Notification from flutter group, open '
'slack and check it out',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
),
const SizedBox(
height: 16,
),
RichText(
text: const TextSpan(
style: TextStyle(
fontWeight: FontWeight.w400,
color: Colors.black,
),
const SizedBox(
height: 16,
),
const Text(
'Hi, you have new Notification from flutter group, open '
'slack and check it out',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
),
const SizedBox(
height: 16,
),
RichText(
text: const TextSpan(
style: TextStyle(
fontWeight: FontWeight.w400,
color: Colors.black,
),
children: [
TextSpan(text: 'Hi team,\n\n'),
TextSpan(
text: 'As some of you know, we’re moving to Slack for '
'our internal team communications. Slack is a '
'messaging app where we can talk, share files, '
'and work together. It also connects with tools '
'we already use, like [add your examples here], '
'plus 900+ other apps.\n\n',
),
children: [
TextSpan(text: 'Hi team,\n\n'),
TextSpan(
text:
'As some of you know, we’re moving to Slack for '
'our internal team communications. Slack is a '
'messaging app where we can talk, share files, '
'and work together. It also connects with tools '
'we already use, like [add your examples here], '
'plus 900+ other apps.\n\n',
),
TextSpan(
text: 'Why are we moving to Slack?\n\n',
style: TextStyle(
fontWeight: FontWeight.w600,
color: Colors.black,
),
),
TextSpan(
text:
'We want to use the best communication tools to '
'make our lives easier and be more productive. '
'Having everything in one place will help us '
'work together better and faster, rather than '
'jumping around between emails, IMs, texts and '
'a bunch of other programs. Everything you share '
'in Slack is automatically indexed and archived, '
'creating a searchable archive of all our work.',
TextSpan(
text: 'Why are we moving to Slack?\n\n',
style: TextStyle(
fontWeight: FontWeight.w600,
color: Colors.black,
),
],
),
),
TextSpan(
text: 'We want to use the best communication tools to '
'make our lives easier and be more productive. '
'Having everything in one place will help us '
'work together better and faster, rather than '
'jumping around between emails, IMs, texts and '
'a bunch of other programs. Everything you share '
'in Slack is automatically indexed and archived, '
'creating a searchable archive of all our work.',
),
],
),
],
),
),
],
),
);
},
),
),
);
},
);
}
}
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class MyApp extends StatelessWidget {
}
},
blurValue: 1,
builder: Builder(builder: (context) => const MailPage()),
autoPlayDelay: const Duration(seconds: 3),
builder: (context) => const MailPage(),
),
),
);
Expand Down
6 changes: 4 additions & 2 deletions lib/src/showcase_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import 'package:flutter/material.dart';
import '../showcaseview.dart';

class ShowCaseWidget extends StatefulWidget {
final Builder builder;
final WidgetBuilder builder;

/// Triggered when all the showcases are completed.
final VoidCallback? onFinish;
Expand Down Expand Up @@ -259,7 +259,9 @@ class ShowCaseWidgetState extends State<ShowCaseWidget> {
Widget build(BuildContext context) {
return _InheritedShowCaseView(
activeWidgetIds: ids?.elementAt(activeWidgetId!),
child: widget.builder,
child: Builder(
builder: widget.builder,
),
);
}
}
Expand Down

0 comments on commit fbf43c2

Please sign in to comment.