Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added pause() and start() methods to Wave widget; simplified example;… #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion example/lib/generated_plugin_registrant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

// ignore_for_file: directives_ordering
// ignore_for_file: lines_longer_than_80_chars
// ignore_for_file: depend_on_referenced_packages

import 'package:url_launcher_web/url_launcher_web.dart';

Expand Down
237 changes: 84 additions & 153 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:wave/config.dart';
import 'package:wave/wave.dart';
Expand All @@ -16,7 +15,6 @@ class WaveDemoApp extends StatelessWidget {
title: appName,
theme: ThemeData(
primarySwatch: Colors.indigo,
useMaterial3: true,
),
home: WaveDemoHomePage(title: appName),
);
Expand All @@ -33,32 +31,24 @@ class WaveDemoHomePage extends StatefulWidget {
}

class _WaveDemoHomePageState extends State<WaveDemoHomePage> {
_buildCard({
required Config config,
Color? backgroundColor = Colors.transparent,
DecorationImage? backgroundImage,
double height = 152.0,
}) {
return Container(
height: height,
width: double.infinity,
child: Card(
elevation: 12.0,
margin: EdgeInsets.only(
right: marginHorizontal, left: marginHorizontal, bottom: 16.0),
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(16.0))),
child: WaveWidget(
config: config,
backgroundColor: backgroundColor,
backgroundImage: backgroundImage,
size: Size(double.infinity, double.infinity),
waveAmplitude: 0,
),
),
);
}

var wave = WaveWidget(
config: CustomConfig(
gradients: [
[Colors.red, Color(0xEEF44336)],
[Colors.red[800]!, Color(0x77E57373)],
[Colors.orange, Color(0x66FF9800)],
[Colors.yellow, Color(0x55FFEB3B)]
],
durations: [35000, 19440, 10800, 6000],
heightPercentages: [0.20, 0.23, 0.25, 0.30],
gradientBegin: Alignment.bottomLeft,
gradientEnd: Alignment.topRight,
),
backgroundColor: Colors.purpleAccent,
size: Size(double.infinity, double.infinity),
waveAmplitude: 0,
);

double marginHorizontal = 16.0;

Expand All @@ -68,10 +58,8 @@ class _WaveDemoHomePageState extends State<WaveDemoHomePage> {

@override
Widget build(BuildContext context) {
marginHorizontal = 16.0 +
(MediaQuery.of(context).size.width > 512
? (MediaQuery.of(context).size.width - 512) / 2
: 0);
marginHorizontal =
16.0 + (MediaQuery.of(context).size.width > 512 ? (MediaQuery.of(context).size.width - 512) / 2 : 0);
return Scaffold(
appBar: AppBar(
title: Text(widget.title!),
Expand All @@ -96,135 +84,78 @@ class _WaveDemoHomePageState extends State<WaveDemoHomePage> {
child: ListView(
children: <Widget>[
SizedBox(height: 16.0),
_buildCard(
backgroundColor: Colors.purpleAccent,
config: CustomConfig(
gradients: [
[Colors.red, Color(0xEEF44336)],
[Colors.red[800]!, Color(0x77E57373)],
[Colors.orange, Color(0x66FF9800)],
[Colors.yellow, Color(0x55FFEB3B)]
],
durations: [35000, 19440, 10800, 6000],
heightPercentages: [0.20, 0.23, 0.25, 0.30],
gradientBegin: Alignment.bottomLeft,
gradientEnd: Alignment.topRight,
),
),
_buildCard(
height: 256.0,
backgroundImage: DecorationImage(
image: NetworkImage(
'https://images.unsplash.com/photo-1554779147-a2a22d816042?crop=entropy&cs=tinysrgb&fm=jpg&ixlib=rb-1.2.1&q=80&raw_url=true&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=3540',
),
fit: BoxFit.cover,
colorFilter:
ColorFilter.mode(Colors.white, BlendMode.softLight),
),
config: CustomConfig(
colors: [
Colors.pink[400]!,
Colors.pink[300]!,
Colors.pink[200]!,
Colors.pink[100]!
],
durations: [18000, 8000, 5000, 12000],
heightPercentages: [0.85, 0.86, 0.88, 0.90],
),
),
_buildCard(
config: CustomConfig(
colors: [
Colors.white70,
Colors.white54,
Colors.white30,
Colors.white24,
],
durations: [32000, 21000, 18000, 5000],
heightPercentages: [0.25, 0.26, 0.28, 0.31],
),
backgroundColor: Colors.blue[600]),
Align(
child: Container(
height: 128,
width: 128,
decoration:
BoxDecoration(shape: BoxShape.circle, boxShadow: [
BoxShadow(
color: Color(0xFF9B5DE5),
blurRadius: 2.0,
spreadRadius: -5.0,
offset: Offset(0.0, 8.0),
),
]),
child: ClipOval(
child: WaveWidget(
config: CustomConfig(
colors: [
Color(0xFFFEE440),
Color(0xFF00BBF9),
],
durations: [
5000,
4000,
],
heightPercentages: [
0.65,
0.66,
],
),
backgroundColor: Color(0xFFF15BB5),
size: Size(double.infinity, double.infinity),
waveAmplitude: 0,
),
),
),
),
const SizedBox(
height: 88,
),
Container(
alignment: Alignment.center,
margin: const EdgeInsets.all(16),
child: Column(
children: [
Image.asset(
'icons/ic_glory_lab.png',
package: 'web3_icons',
width: 32.0,
height: 32.0,
),
const SizedBox(height: 8),
Text(
'Made in Glory Lab',
style: GoogleFonts.robotoMono(
color: Colors.grey[500],
),
)
],
)),
Container(
height: 48,
child: WaveWidget(
config: CustomConfig(
colors: [
Colors.indigo[400]!,
Colors.indigo[300]!,
Colors.indigo[200]!,
Colors.indigo[100]!
],
durations: [18000, 8000, 5000, 12000],
heightPercentages: [0.65, 0.66, 0.68, 0.70],
),
size: Size(double.infinity, double.infinity),
waveAmplitude: 0,
height: 152,
width: double.infinity,
child: Card(
elevation: 12.0,
margin: EdgeInsets.only(right: marginHorizontal, left: marginHorizontal, bottom: 16.0),
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16.0))),
child: wave,
// WaveWidget(
// config: CustomConfig(
// gradients: [
// [Colors.red, Color(0xEEF44336)],
// [Colors.red[800]!, Color(0x77E57373)],
// [Colors.orange, Color(0x66FF9800)],
// [Colors.yellow, Color(0x55FFEB3B)]
// ],
// durations: [35000, 19440, 10800, 6000],
// heightPercentages: [0.20, 0.23, 0.25, 0.30],
// gradientBegin: Alignment.bottomLeft,
// gradientEnd: Alignment.topRight,
// ),
// backgroundColor: Colors.purpleAccent,
// size: Size(double.infinity, double.infinity),
// waveAmplitude: 0,
// ),
),
),
// Align(
// child: Container(
// height: 128,
// width: 128,
// decoration:
// BoxDecoration(shape: BoxShape.circle, boxShadow: [
// BoxShadow(
// color: Color(0xFF9B5DE5),
// blurRadius: 2.0,
// spreadRadius: -5.0,
// offset: Offset(0.0, 8.0),
// ),
// ]),
// child: ClipOval(
// child: WaveWidget(
// config: CustomConfig(
// colors: [
// Color(0xFFFEE440),
// Color(0xFF00BBF9),
// ],
// durations: [
// 5000,
// 4000,
// ],
// heightPercentages: [
// 0.65,
// 0.66,
// ],
// ),
// backgroundColor: Color(0xFFF15BB5),
// size: Size(double.infinity, double.infinity),
// waveAmplitude: 0,
// ),
// ),
// ),
// ),
],
),
),
],
),
floatingActionButton: FloatingActionButton(
onPressed: () { wave.animating ? wave.pause() : wave.start(); },
),
);
}
}
7 changes: 7 additions & 0 deletions example/macos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/

# Xcode-related
**/dgph
**/xcuserdata/
2 changes: 2 additions & 0 deletions example/macos/Flutter/Flutter-Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
2 changes: 2 additions & 0 deletions example/macos/Flutter/Flutter-Release.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
12 changes: 12 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// Generated file. Do not edit.
//

import FlutterMacOS
import Foundation

import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
40 changes: 40 additions & 0 deletions example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
platform :osx, '10.11'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
Loading