|  | 
| 2 | 2 | // Use of this source code is governed by an Apache license that can be found | 
| 3 | 3 | // in the LICENSE file. | 
| 4 | 4 | 
 | 
| 5 |  | -import 'package:flutter/material.dart'; | 
|  | 5 | +import 'package:flutter/material.dart' hide Path; | 
| 6 | 6 | import 'package:flutter/services.dart'; | 
| 7 | 7 | import 'package:photo_manager/photo_manager.dart'; | 
| 8 |  | -import 'package:wechat_picker_library/wechat_picker_library.dart'; | 
|  | 8 | +import 'package:wechat_picker_library/wechat_picker_library.dart' | 
|  | 9 | +    show buildTheme; | 
| 9 | 10 | 
 | 
| 10 | 11 | import '../constants/config.dart'; | 
| 11 | 12 | import '../constants/constants.dart'; | 
| @@ -243,112 +244,6 @@ class AssetPickerDelegate { | 
| 243 | 244 |   /// 设置 [light] 为 true 时可以获取浅色版本的主题。 | 
| 244 | 245 |   /// {@endtemplate} | 
| 245 | 246 |   ThemeData themeData(Color? themeColor, {bool light = false}) { | 
| 246 |  | -    themeColor ??= defaultThemeColorWeChat; | 
| 247 |  | -    if (light) { | 
| 248 |  | -      return ThemeData.light().copyWith( | 
| 249 |  | -        primaryColor: Colors.grey[50], | 
| 250 |  | -        primaryColorLight: Colors.grey[50], | 
| 251 |  | -        primaryColorDark: Colors.grey[50], | 
| 252 |  | -        canvasColor: Colors.grey[100], | 
| 253 |  | -        scaffoldBackgroundColor: Colors.grey[50], | 
| 254 |  | -        cardColor: Colors.grey[50], | 
| 255 |  | -        highlightColor: Colors.transparent, | 
| 256 |  | -        textSelectionTheme: TextSelectionThemeData( | 
| 257 |  | -          cursorColor: themeColor, | 
| 258 |  | -          selectionColor: themeColor.withAlpha(100), | 
| 259 |  | -          selectionHandleColor: themeColor, | 
| 260 |  | -        ), | 
| 261 |  | -        indicatorColor: themeColor, | 
| 262 |  | -        appBarTheme: AppBarTheme( | 
| 263 |  | -          backgroundColor: Colors.grey[100], | 
| 264 |  | -          systemOverlayStyle: const SystemUiOverlayStyle( | 
| 265 |  | -            statusBarBrightness: Brightness.light, | 
| 266 |  | -            statusBarIconBrightness: Brightness.dark, | 
| 267 |  | -          ), | 
| 268 |  | -          iconTheme: IconThemeData(color: Colors.grey[900]), | 
| 269 |  | -          elevation: 0, | 
| 270 |  | -        ), | 
| 271 |  | -        bottomAppBarTheme: BottomAppBarTheme( | 
| 272 |  | -          color: Colors.grey[100], | 
| 273 |  | -        ), | 
| 274 |  | -        buttonTheme: ButtonThemeData(buttonColor: themeColor), | 
| 275 |  | -        iconTheme: IconThemeData(color: Colors.grey[900]), | 
| 276 |  | -        checkboxTheme: CheckboxThemeData( | 
| 277 |  | -          checkColor: MaterialStateProperty.all(Colors.black), | 
| 278 |  | -          fillColor: MaterialStateProperty.resolveWith((states) { | 
| 279 |  | -            if (states.contains(MaterialState.selected)) { | 
| 280 |  | -              return themeColor; | 
| 281 |  | -            } | 
| 282 |  | -            return null; | 
| 283 |  | -          }), | 
| 284 |  | -          side: const BorderSide(color: Colors.black), | 
| 285 |  | -        ), | 
| 286 |  | -        colorScheme: ColorScheme( | 
| 287 |  | -          primary: Colors.grey[50]!, | 
| 288 |  | -          secondary: themeColor, | 
| 289 |  | -          background: Colors.grey[50]!, | 
| 290 |  | -          surface: Colors.grey[50]!, | 
| 291 |  | -          brightness: Brightness.light, | 
| 292 |  | -          error: const Color(0xffcf6679), | 
| 293 |  | -          onPrimary: Colors.white, | 
| 294 |  | -          onSecondary: Colors.grey[100]!, | 
| 295 |  | -          onSurface: Colors.black, | 
| 296 |  | -          onBackground: Colors.black, | 
| 297 |  | -          onError: Colors.white, | 
| 298 |  | -        ), | 
| 299 |  | -      ); | 
| 300 |  | -    } | 
| 301 |  | -    return ThemeData.dark().copyWith( | 
| 302 |  | -      primaryColor: Colors.grey[900], | 
| 303 |  | -      primaryColorLight: Colors.grey[900], | 
| 304 |  | -      primaryColorDark: Colors.grey[900], | 
| 305 |  | -      canvasColor: Colors.grey[850], | 
| 306 |  | -      scaffoldBackgroundColor: Colors.grey[900], | 
| 307 |  | -      cardColor: Colors.grey[900], | 
| 308 |  | -      highlightColor: Colors.transparent, | 
| 309 |  | -      textSelectionTheme: TextSelectionThemeData( | 
| 310 |  | -        cursorColor: themeColor, | 
| 311 |  | -        selectionColor: themeColor.withAlpha(100), | 
| 312 |  | -        selectionHandleColor: themeColor, | 
| 313 |  | -      ), | 
| 314 |  | -      indicatorColor: themeColor, | 
| 315 |  | -      appBarTheme: AppBarTheme( | 
| 316 |  | -        backgroundColor: Colors.grey[850], | 
| 317 |  | -        systemOverlayStyle: const SystemUiOverlayStyle( | 
| 318 |  | -          statusBarBrightness: Brightness.dark, | 
| 319 |  | -          statusBarIconBrightness: Brightness.light, | 
| 320 |  | -        ), | 
| 321 |  | -        iconTheme: const IconThemeData(color: Colors.white), | 
| 322 |  | -        elevation: 0, | 
| 323 |  | -      ), | 
| 324 |  | -      bottomAppBarTheme: BottomAppBarTheme( | 
| 325 |  | -        color: Colors.grey[850], | 
| 326 |  | -      ), | 
| 327 |  | -      buttonTheme: ButtonThemeData(buttonColor: themeColor), | 
| 328 |  | -      iconTheme: const IconThemeData(color: Colors.white), | 
| 329 |  | -      checkboxTheme: CheckboxThemeData( | 
| 330 |  | -        checkColor: MaterialStateProperty.all(Colors.white), | 
| 331 |  | -        fillColor: MaterialStateProperty.resolveWith((states) { | 
| 332 |  | -          if (states.contains(MaterialState.selected)) { | 
| 333 |  | -            return themeColor; | 
| 334 |  | -          } | 
| 335 |  | -          return null; | 
| 336 |  | -        }), | 
| 337 |  | -        side: const BorderSide(color: Colors.white), | 
| 338 |  | -      ), | 
| 339 |  | -      colorScheme: ColorScheme( | 
| 340 |  | -        primary: Colors.grey[900]!, | 
| 341 |  | -        secondary: themeColor, | 
| 342 |  | -        background: Colors.grey[900]!, | 
| 343 |  | -        surface: Colors.grey[900]!, | 
| 344 |  | -        brightness: Brightness.dark, | 
| 345 |  | -        error: const Color(0xffcf6679), | 
| 346 |  | -        onPrimary: Colors.black, | 
| 347 |  | -        onSecondary: Colors.grey[850]!, | 
| 348 |  | -        onSurface: Colors.white, | 
| 349 |  | -        onBackground: Colors.white, | 
| 350 |  | -        onError: Colors.black, | 
| 351 |  | -      ), | 
| 352 |  | -    ); | 
|  | 247 | +    return buildTheme(themeColor, light: light); | 
| 353 | 248 |   } | 
| 354 | 249 | } | 
0 commit comments