Skip to content

useSubThemes get the cards borderRadius #40

Closed Answered by rydmike
jlnrrg asked this question in Q&A
Discussion options

You must be logged in to vote

Hi again @jlnrrg, so to return as promised to your BoxDecoration example and question. This should work:

  @override
  Widget build(BuildContext context) {
    final ThemeData theme = Theme.of(context);
    // Get the card theme's ShapeBorder.
    ShapeBorder? border = theme.cardTheme.shape;
   // Make a BorderRadius that defaults to default un-themed Card's border radius behavior of 4.
    BorderRadius radius = const BorderRadius.all(Radius.circular(4));
    // If we have ShapeBorder in card theme of type RoundedRectangleBorder, grab its 
    // border radius, if it is a BorderRadius.
    if (border is RoundedRectangleBorder) {
      if (border.borderRadius is BorderRadius) {
        rad…

Replies: 8 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by rydmike
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question This issue is a usage question and will be moved to the Discussions section.
2 participants
Converted from issue

This discussion was converted from issue #23 on April 06, 2022 01:15.