frosted 1.0.0
frosted: ^1.0.0 copied to clipboard
A comprehensive, highly customizable Flutter UI kit with a frosted glass aesthetic. Supports RTL/LTR and localization.
import 'package:flutter/material.dart';
import 'package:frosted/frosted.dart';
import 'screens/home_screen.dart';
import 'widgets/demo_background.dart';
void main() {
runApp(const FrostedExampleApp());
}
class FrostedExampleApp extends StatefulWidget {
const FrostedExampleApp({super.key});
@override
State<FrostedExampleApp> createState() => _FrostedExampleAppState();
}
class _FrostedExampleAppState extends State<FrostedExampleApp> {
Locale _locale = const Locale('en');
bool _isRtl = false;
void _toggleLocale() {
setState(() {
if (_locale.languageCode == 'en') {
_locale = const Locale('ar');
_isRtl = true;
} else {
_locale = const Locale('en');
_isRtl = false;
}
});
}
@override
Widget build(BuildContext context) {
final frostedTheme = const FrostedThemeData(
glossiness: 0.78,
surfaceOpacity: 0.14,
activeColor: Color(0xFF2DD4BF),
borderRadius: BorderRadius.all(Radius.circular(16)),
enableSpecularHighlight: true,
);
return MaterialApp(
title: 'Frosted UI Kit',
debugShowCheckedModeBanner: false,
locale: _locale,
localizationsDelegates: frostedLocalizationDelegates,
supportedLocales: const [
Locale('en'),
Locale('ar'),
Locale('fr'),
Locale('de'),
],
theme: applyFrostedInteractionTheme(
ThemeData.dark().copyWith(
scaffoldBackgroundColor: const Color(0xFF0A0A0F),
brightness: Brightness.dark,
),
),
builder: (context, child) {
return Directionality(
textDirection: _isRtl ? TextDirection.rtl : TextDirection.ltr,
child: FrostedMessengerScope(
child: FrostedTheme(
data: frostedTheme,
child: DemoBackground(child: child!),
),
),
);
},
home: HomeScreen(onToggleLocale: _toggleLocale, isRtl: _isRtl),
);
}
}