Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义添加selectionOverlay完全被挡住了 #198

Open
LiFuPeng opened this issue May 9, 2023 · 0 comments
Open

自定义添加selectionOverlay完全被挡住了 #198

LiFuPeng opened this issue May 9, 2023 · 0 comments

Comments

@LiFuPeng
Copy link

LiFuPeng commented May 9, 2023

selectionOverlay: Container(
decoration: BoxDecoration(borderRadius: BorderRadiusDirectional.horizontal(
start: Radius.circular(16),
end: Radius.circular(16),
),
),
margin: EdgeInsetsDirectional.only(
start: 20,
end: 20,
),
height: 50,
color: CupertinoDynamicColor.resolve(const Color.fromRGBO(245, 246, 248, 1), context),),

完整代码:

@OverRide
Widget build(BuildContext context) {
return Picker(
hideHeader: true,
adapter: PickerDataAdapter(
pickerData: ages.map((e) => '${e['label']}岁').toList(),
isArray: false,
),
height: widget.height,
itemExtent: 50.w,
textAlign: TextAlign.center,
textStyle: TextStyle(color: const Color.fromRGBO(105, 115, 128, 1),
fontSize: 15.sp, fontWeight: FontsUtils.R,
fontFamily: FontsUtils.OPPOSansR,
),

  selectedTextStyle: TextStyle(color: const Color.fromRGBO(2, 17, 31, 1),
    fontSize: 15.sp, fontWeight: FontsUtils.R,
    fontFamily: FontsUtils.OPPOSansR,
  ),

  selectionOverlay: Container(
    decoration: BoxDecoration(borderRadius: BorderRadiusDirectional.horizontal(
      start: Radius.circular(16.w),
      end: Radius.circular(16.w),
    ),),

    margin: EdgeInsetsDirectional.only(
      start: 20.w,
      end: 20.w,
    ),
    height: 50.w,
    // color: const Color.fromRGBO(245, 246, 248, 1).withOpacity(0.5),
    color: CupertinoDynamicColor.resolve(const Color.fromRGBO(245, 246, 248, 1), context),
  ),
  // selectionOverlay: const CupertinoPickerDefaultSelectionOverlay(background: Color.fromRGBO(245, 246, 248, 1),),

  backgroundColor: Colors.transparent,
  selecteds: _defaultSelecteds,
  onSelect: (Picker picker, int index, List<int> selected) {
    print(selected);
    _selectAge(index);
  },
).makePicker();

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant