neumorphic_flutter_kr 0.2.0
neumorphic_flutter_kr: ^0.2.0 copied to clipboard
뉴로모픽(Neumorphic) 스타일 위젯을 쉽게 사용할 수 있는 한글 친화 Flutter 패키지 · 한글 샘플/실시간 코드 생성 제공
import 'package:flutter/material.dart';
import 'glassmorphic_demo.dart';
import 'interactive_demo.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
ThemeMode _themeMode = ThemeMode.light;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'neumorphic_flutter_kr 예제',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blue,
brightness: Brightness.light,
),
useMaterial3: true,
),
darkTheme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blueGrey,
brightness: Brightness.dark,
),
useMaterial3: true,
),
themeMode: _themeMode,
home: RootPage(
themeMode: _themeMode,
onThemeModeChanged: (mode) => setState(() => _themeMode = mode),
),
);
}
}
/// 하단 네비게이션으로 뉴모피즘 ↔ 글래스모피즘 데모 전환
///
/// - [0] 뉴모피즘: InteractiveDemo (자체 AppBar + 컨트롤 패널 포함)
/// - [1] 글래스모피즘: GlassmorphicDemo (그라데이션 배경 + 뉴모피즘 비교)
class RootPage extends StatefulWidget {
final ThemeMode themeMode;
final ValueChanged<ThemeMode> onThemeModeChanged;
const RootPage({
super.key,
required this.themeMode,
required this.onThemeModeChanged,
});
@override
State<RootPage> createState() => _RootPageState();
}
class _RootPageState extends State<RootPage> {
int _currentIndex = 0;
@override
Widget build(BuildContext context) {
// 외부 Scaffold: 바텀 네비만 담당 (AppBar 없음)
// 내부 InteractiveDemo/GlassmorphicPage 각자 Scaffold+AppBar 소유
// → Flutter 중첩 Scaffold 지원으로 정상 동작
return Scaffold(
body: IndexedStack(
index: _currentIndex,
children: [
InteractiveDemo(
themeMode: widget.themeMode,
onThemeModeChanged: widget.onThemeModeChanged,
),
_GlassmorphicPage(),
],
),
bottomNavigationBar: NavigationBar(
selectedIndex: _currentIndex,
onDestinationSelected: (i) => setState(() => _currentIndex = i),
destinations: const [
NavigationDestination(
icon: Icon(Icons.view_in_ar_outlined),
selectedIcon: Icon(Icons.view_in_ar),
label: '뉴모피즘',
),
NavigationDestination(
icon: Icon(Icons.blur_on_outlined),
selectedIcon: Icon(Icons.blur_on),
label: '글래스모피즘',
),
],
),
);
}
}
class _GlassmorphicPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('글래스모피즘 데모'),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
body: const GlassmorphicDemo(),
);
}
}