-
Notifications
You must be signed in to change notification settings - Fork 147
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
版本信息
- Flutter版本:[v2.10.5]
- flutter_smart_dialog版本:[v4.0.2]
描述bug/需求
SmartDialog.showAttach scrollbar 不能设置为isAlwaysShown
err:ScrollController attached to multiple scroll views.
问题demo
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SmartDialogPage(),
navigatorObservers: [FlutterSmartDialog.observer],
builder: FlutterSmartDialog.init(),
);
}
}
class SmartDialogPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(title: Text('SmartDialog-EasyDemo')),
body: Container(
alignment: Alignment.center,
child: ElevatedButton(
onPressed: () => _showAttach(context),
child: Text('showAttach'),
),
),
);
}
void _showAttach(BuildContext ctx) {
final scrolcontroller = ScrollController();
var attachDialog = (BuildContext context) {
SmartDialog.showAttach(
targetContext: context,
alignment: Alignment.topCenter,
useSystem: true,
builder: (_) {
return Container(
height: 150,
child: CupertinoScrollbar(
isAlwaysShown: true,
// controller: scrolcontroller,
child: ListView.builder(
// controller: scrolcontroller,
padding: const EdgeInsets.all(0),
itemBuilder: (_, i) {
return Container(
width: 50,
height: 50,
color: Colors.primaries[i],
);
},
itemCount: Colors.primaries.length - 1,
),
),
);
},
);
};
// var attachDialog = (BuildContext context) {
// SmartDialog.show(
// // targetContext:/ context,
// alignment: Alignment.topCenter,
// useSystem: true,
// builder: (_) {
// return Container(
// height: 150,
// child: CupertinoScrollbar(
// isAlwaysShown: true,
// controller: scrolcontroller,
// child: ListView.builder(
// controller: scrolcontroller,
// padding: const EdgeInsets.all(0),
// itemBuilder: (_, i) {
// return Container(
// width: 50,
// height: 50,
// color: Colors.primaries[i],
// );
// },
// itemCount: Colors.primaries.length - 1,
// ),
// ),
// );
// },
// );
// };
//target widget
SmartDialog.show(
useSystem: true,
builder: (_) {
return Container(
height: 300,
width: 500,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.white,
),
alignment: Alignment.center,
child: Builder(builder: (context) {
return ElevatedButton(
onPressed: () => attachDialog(context),
child: Text('target widget'),
);
}),
);
},
);
}
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working