Flutter Cupertino/Material combined Theme / shared font family

1.5k views Asked by At

I've been trying to solve a couple of problems using both Material and Cupertino widgets.

1) I can't seem to figure out how to globally define a font family for both. Either I use a CupertinoApp and have the Cupertino widgets correct or MaterialApp and have the Material theme widgets correct.

2) How do I define the Cupertino primaryColor attribute without a CupertinoTheme?

I've found something called MaterialBasedCupertinoThemeData but I'm not sure how it works / can't find any docs/tutorials on it.

I can't find any other questions on the subject and would appreciate the help!

  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      title: 'betterfriend',
      debugShowCheckedModeBanner: false,
      // This lets us use material components
      localizationsDelegates: <LocalizationsDelegate<dynamic>>[
        DefaultMaterialLocalizations.delegate,
        DefaultWidgetsLocalizations.delegate,
        DefaultCupertinoLocalizations.delegate,
      ],

      home: CupertinoTheme(
        data: MaterialBasedCupertinoThemeData(
          materialTheme: ThemeData(textTheme: Styles.textTheme),
        ),
        child: ScreenSwitcher(),
      ),
    );
  }
0

There are 0 answers